Reputation: 11
I need a separate log to be created in the Red Hat EAP Console Runtime Log Viewer. This because my server hosts two projects and both print their logs in the default "server.log".
This is my log4j.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration>
<appender name="C" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%-5p,%d %r,%c{1},%t] %m%n" />
</layout>
</appender>
<appender name="F" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${jboss.server.log.dir}${file.separator}myProject.log" />
<param name="Append" value="true" />
<param name="MaxFileSize" value="10MB" />
<param name="MaxBackupIndex" value="10" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%-5p,%d %r,%c{1},%t] %m%n" />
</layout>
</appender>
<root>
<priority value="INFO" />
<appender-ref ref="C" />
<appender-ref ref="F" />
</root>
</log4j:configuration>
Upvotes: 1
Views: 136
Reputation: 20820
You have couple of options that can be utilized as part of management:
Use logging profiles.
Create a file handler for each application and assign a category as explained here
You can also copy your own logging.properties file in your application packages but then you wont be able to manage them centrally since it;s outside standalone/domain XML and set as per deployment.
Upvotes: 1