Closed unigogyk closed 2 years ago
System.setProperty("logging.path", "your_path");
应该可以
多谢 这个地方我看到了,请问还有其他方式吗? 在系统环境中 “logging.path”这个变量名重名的概率比较高
多谢 这个地方我看到了,请问还有其他方式吗? 在系统环境中 “logging.path”这个变量名重名的概率比较高
我不知道其他方式了,可以 bolt 社区提个 issue 问下 https://github.com/sofastack/sofa-bolt
好的 非常感谢
bolt默认路径是${user.home}/logs/bolt/xxx.log,想把bolt日志路径更改为指定路径。 我按照bolt的log4j配置文件做了修改: https://github.com/sofastack/sofa-bolt/blob/master/src/main/resources/com/alipay/remoting/log/log4j/log-conf.xml
但是在我的日志路径下虽然有bolt的日志文件,但是文件是空的(文件大小为0)。 而默认路径 ${user.home}/logs/bolt/xxx.log 下还是生成了bolt日志,并且文件是有内容的。
我的环境是log4j 1.2.15,sofa-jraft 1.3.7。 log4j.properties 配置如下:
log4j.rootLogger=${root.logger}, EventCounter log4j.threshhold=ALL
log4j.logger.CommonDefault=INFO,CommonDefaultAppender,ERROR-APPENDER log4j.additivity.CommonDefault=false log4j.appender.CommonDefaultAppender=org.apache.log4j.RollingFileAppender log4j.appender.CommonDefaultAppender.File=${log.dir}/bolt/common-default.log log4j.appender.CommonDefaultAppender.MaxFileSize=200MB log4j.appender.CommonDefaultAppender.MaxBackupIndex=10 log4j.appender.CommonDefaultAppender.layout=org.apache.log4j.PatternLayout log4j.appender.CommonDefaultAppender.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n
log4j.logger.ConnectionEvent=INFO,ConnectionEventAppender,ERROR-APPENDER log4j.additivity.ConnectionEvent=false log4j.appender.ConnectionEventAppender=org.apache.log4j.RollingFileAppender log4j.appender.ConnectionEventAppender.File=${log.dir}/bolt/connection-event.log log4j.appender.ConnectionEventAppender.MaxFileSize=200MB log4j.appender.ConnectionEventAppender.MaxBackupIndex=10 log4j.appender.ConnectionEventAppender.layout=org.apache.log4j.PatternLayout log4j.appender.ConnectionEventAppender.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n
log4j.logger.RpcRemoting=INFO,RpcRemotingAppender,ERROR-APPENDER log4j.additivity.RpcRemoting=false log4j.appender.RpcRemotingAppender=org.apache.log4j.RollingFileAppender log4j.appender.RpcRemotingAppender.File=${log.dir}/bolt/remoting-rpc.log log4j.appender.RpcRemotingAppender.MaxFileSize=200MB log4j.appender.RpcRemotingAppender.MaxBackupIndex=10 log4j.appender.RpcRemotingAppender.layout=org.apache.log4j.PatternLayout log4j.appender.RpcRemotingAppender.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n
log4j.logger.TrAdapterRemoting=INFO,TrAdapterRemotingAppender,ERROR-APPENDER log4j.additivity.TrAdapterRemoting=false log4j.appender.TrAdapterRemotingAppender=org.apache.log4j.RollingFileAppender log4j.appender.TrAdapterRemotingAppender.File=${log.dir}/bolt/remoting-tr-adapter.log log4j.appender.TrAdapterRemotingAppender.MaxFileSize=200MB log4j.appender.TrAdapterRemotingAppender.MaxBackupIndex=10 log4j.appender.TrAdapterRemotingAppender.layout=org.apache.log4j.PatternLayout log4j.appender.TrAdapterRemotingAppender.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n
log4j.logger.MsgRemoting=INFO,MsgRemotingAppender,ERROR-APPENDER log4j.additivity.MsgRemoting=false log4j.appender.MsgRemotingAppender=org.apache.log4j.RollingFileAppender log4j.appender.MsgRemotingAppender.File=${log.dir}/bolt/remoting-msg.log log4j.appender.MsgRemotingAppender.MaxFileSize=200MB log4j.appender.MsgRemotingAppender.MaxBackupIndex=10 log4j.appender.MsgRemotingAppender.layout=org.apache.log4j.PatternLayout log4j.appender.MsgRemotingAppender.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n
log4j.logger.HttpRemoting=INFO,HttpRemotingAppender,ERROR-APPENDER log4j.additivity.HttpRemoting=false log4j.appender.HttpRemotingAppender=org.apache.log4j.RollingFileAppender log4j.appender.HttpRemotingAppender.File=${log.dir}/bolt/remoting-http.log log4j.appender.HttpRemotingAppender.MaxFileSize=200MB log4j.appender.HttpRemotingAppender.MaxBackupIndex=10 log4j.appender.HttpRemotingAppender.layout=org.apache.log4j.PatternLayout log4j.appender.HttpRemotingAppender.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n
log4j.appender.ERROR-APPENDER=org.apache.log4j.RollingFileAppender log4j.appender.ERROR-APPENDER.File=${log.dir}/bolt/common-error.log log4j.appender.ERROR-APPENDER.MaxFileSize=200MB log4j.appender.ERROR-APPENDER.MaxBackupIndex=10 log4j.appender.ERROR-APPENDER.layout=org.apache.log4j.PatternLayout log4j.appender.ERROR-APPENDER.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n