我的系统中同时运行一个可执行jar,侦听两个不同的接口套接字
java -ip <port-1-IP> -jar executable.jar
java -ip <port-2-IP> -jar executable.jar
log4j附加程序配置如下
<appender name="workflow" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="true" />
<param name="maxFileSize" value="50MB" />
<param name="file" value="/var/log/public_access_workflow.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
</layout>
<param name="MaxBackupIndex" value="5" />
</appender>
<appender name="workflow_csv" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="true" />
<param name="maxFileSize" value="50MB" />
<param name="file" value="/var/log/public_access_workflow_csv.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n" />
</layout>
<param name="MaxBackupIndex" value="5" />
</appender>
<appender name="workflow_comms" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="true" />
<param name="maxFileSize" value="50MB" />
<param name="file" value="/var/log/public_access_workflow_comms.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
</layout>
<param name="MaxBackupIndex" value="5" />
</appender>
在运行时或启动时是否可以更改log4j文件?
编辑:
使用Linux和Jetty服务器(org.eclipse.jetty.server.Server
)和org.apache.log4j.Logger