有个一个test.jar,里面用了log4j做日志输出。现在是输出到logs文件夹里
但是现在需要换成用一个shell来执行
java -jar test.jar $param1 $param2 > /newLogs/xxxx.log
如何配置才能将log4j的日志直接通过 > 重定向到xxxx.log中?
天蓬老师2017-04-18 10:34:11
appender
使用 console
will be output to the file.
Is this it?
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=INFO
log4j.appender.console.ImmediateFlush=true
log4j.appender.console.Target=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-[Thread: %t]-[%C.%M()]: %m%n