@@ -550,9 +550,22 @@ func (c *calcium) makeContainerOptions(quota map[string]int, specs types.Specs,
550
550
}
551
551
552
552
// log config
553
- logConfig := c .config .Docker .LogDriver
553
+ // 默认是配置里的driver, 如果entrypoint有指定json-file就用json-file.
554
+ // 如果是debug模式就用syslog, 拿配置里的syslog配置来发送.
555
+ logDriver := c .config .Docker .LogDriver
554
556
if entry .LogConfig == "json-file" {
555
- logConfig = "json-file"
557
+ logDriver = "json-file"
558
+ }
559
+ logConfig := enginecontainer.LogConfig {Type : logDriver }
560
+ if opts .Debug {
561
+ logConfig .Type = "syslog"
562
+ logConfig .Config = map [string ]string {
563
+ "syslog-address" : c .config .Syslog .Address ,
564
+ "syslog-facility" : c .config .Syslog .Facility ,
565
+ "syslog-format" : c .config .Syslog .Format ,
566
+ "tag" : "ERU" ,
567
+ "labels" : specs .Appname ,
568
+ }
556
569
}
557
570
558
571
// working dir 默认是空, 也就是根目录
@@ -638,7 +651,7 @@ func (c *calcium) makeContainerOptions(quota map[string]int, specs types.Specs,
638
651
hostConfig := & enginecontainer.HostConfig {
639
652
Binds : binds ,
640
653
DNS : dns ,
641
- LogConfig : enginecontainer. LogConfig { Type : logConfig } ,
654
+ LogConfig : logConfig ,
642
655
NetworkMode : enginecontainer .NetworkMode (networkMode ),
643
656
RestartPolicy : enginecontainer.RestartPolicy {Name : entry .RestartPolicy , MaximumRetryCount : 3 },
644
657
CapAdd : engineslice .StrSlice (capAdd ),
0 commit comments