i am aritinga small application in Linux based system where i am using slf4j libraries for logger
import org.slf4j.Logger; import org.slf4j.LoggerFactory;
i could see the logs are visible in console but not appending to log files.
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="threshold" value="INFO" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%-10t]%m%n" />
</layout>
</appender>
<!-- EXAMPLE logging setup NOTES: 1. files are written to "./logs/<filename>".
You must setup the environment so that ./logs is a symlink to the correct
location according to the EXAMPLE log standard. For example, "/opt/logs/".
If that's not possible, change the File setting in each appender appropriately. -->
<appender name="EXAMPLE_AUDIT" class="org.apache.log4j.RollingFileAppender">
<param name="threshold" value="INFO" />
<param name="File" value="./logs/audit.log" />
<param name="MaxFileSize" value="128MB" />
<param name="MaxBackupIndex" value="20" />
<layout class="com.rsg.ova.logging.log4j.EXAMPLELayout">
<param name="ConversionPattern" value="EXAMPLE_AUDIT" />
</layout>
</appender>
<appender name="EXAMPLE_METRIC" class="org.apache.log4j.RollingFileAppender">
<param name="threshold" value="DEBUG" />
<param name="File" value="./logs/metric.log" />
<param name="MaxFileSize" value="128MB" />
<param name="MaxBackupIndex" value="10" />
<layout class="com.rsg.ova.logging.log4j.EXAMPLELayout">
<param name="ConversionPattern" value="EXAMPLE_METRIC" />
</layout>
</appender>
<appender name="EXAMPLE_ERROR" class="org.apache.log4j.RollingFileAppender">
<param name="threshold" value="ERROR" /> <!-- only WARN and ERROR are allowed in this log -->
<param name="File" value="./logs/error.log" />
<param name="MaxFileSize" value="128MB" />
<param name="MaxBackupIndex" value="10" />
<layout class="com.rsg.ova.logging.log4j.EXAMPLELayout">
<param name="ConversionPattern" value="EXAMPLE_ERROR" />
</layout>
</appender>
<appender name="EXAMPLE_DEBUG" class="org.apache.log4j.RollingFileAppender">
<param name="threshold" value="DEBUG" />
<param name="File" value="./logs/debug.log" />
<param name="MaxFileSize" value="128MB" />
<param name="MaxBackupIndex" value="20" />
<layout class="com.rsg.ova.logging.log4j.EXAMPLELayout">
<param name="ConversionPattern" value="EXAMPLE_DEBUG" />
</layout>
</appender>
<logger name="com.rsg.EXAMPLE.audit" additivity="false">
<level value="info" />
<appender-ref ref="EXAMPLE_AUDIT" />
</logger>
<logger name="com.rsg.EXAMPLE.metrics" additivity="false">
<level value="info" />
<appender-ref ref="EXAMPLE_METRIC" />
</logger>
<logger name="com.rsg.EXAMPLE.error" additivity="false">
<level value="info" />
<appender-ref ref="EXAMPLE_ERROR" />
</logger>
<logger name="com.rsg.EXAMPLE.debug" additivity="false">
<level value="info" />
<appender-ref ref="CONSOLE" />
<appender-ref ref="EXAMPLE_DEBUG" />
</logger>
<root>
<level value="DEBUG" />
<appender-ref ref="EXAMPLE_DEBUG" />
<appender-ref ref="CONSOLE" />
</root>
<logger name="org.openEXAMPLE.agcp.commonFunction.input"
additivity="false">
<level value="INFO" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="org.openEXAMPLE.agcp.commonFunction.output"
additivity="false">
<level value="INFO" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="org.openEXAMPLE.agcp.commonFunction.error"
additivity="false">
<level value="DEBUG" />
<appender-ref ref="CONSOLE" />
<appender-ref ref="EXAMPLE_ERROR" />
</logger>
<!-- The EXAMPLE logging standard has four specific classes of logging that
are unrelated to subsystem logger names. If you want them activated, uncomment
this block. -->
<logger name="com.rsg.EXAMPLE.audit" additivity="false">
<level value="info" />
<appender-ref ref="CONSOLE" />
<appender-ref ref="EXAMPLE_AUDIT" />
</logger>
<logger name="com.rsg.EXAMPLE.metrics" additivity="false">
<level value="info" />
<appender-ref ref="EXAMPLE_METRIC" />
</logger>
<logger name="com.rsg.EXAMPLE.error" additivity="false">
<level value="info" />
<appender-ref ref="EXAMPLE_ERROR" />
</logger>
<logger name="com.rsg.EXAMPLE.debug" additivity="false">
<level value="info" />
<appender-ref ref="EXAMPLE_DEBUG" />
</logger>
<logger name="com.rsg.ova.apiClient.http.HttpClient" additivity="false">
<level value="info" />
<appender-ref ref="EXAMPLE_ERROR" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="com.rsg.ova.roman.client.impl.romanSimplerBatchPublisher"
additivity="false">
<level value="info" />
<appender-ref ref="EXAMPLE_ERROR" />
<appender-ref ref="CONSOLE" />
</logger>