Jump to content

Recommended Posts

Posted

Hi,

 

I am planning to log all my logging in separate file, in local I am able to see my application log file, but it is not coming. Could you please help me. Following are my configurations which I have mentioned in my log4j.xml file. High lighted with RED color for path name.

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >

<log4j:configuration>

 

<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">

<param name="Target" value="System.out" />

<layout class="org.apache.log4j.PatternLayout">

<!-- 

<param name="ConversionPattern"

value="[%d{ISO8601}] %-5p [%c] %m %n" />

-->

<param name="ConversionPattern" value="%-5p [%c] %m %n" />

</layout>

</appender>

 

<appender name="STDERR" class="org.apache.log4j.ConsoleAppender">

<param name="Target" value="System.err" />

<layout class="org.apache.log4j.PatternLayout">

<param name="ConversionPattern"

value="[%d{ISO8601}] %-5p [%c] %m %n" />

</layout>

<filter class="org.apache.log4j.varia.LevelRangeFilter">

<param name="LevelMin" value="INFO" />

<param name="LevelMax" value="FATAL" />

</filter>

</appender>

 

<appender name="SW_ROLLING_FILE"

class="org.apache.log4j.RollingFileAppender">

<param name="File" value="<<my user path>>/logs/savemytime.log" />

<param name="Append" value="true" />

<param name="MaxFileSize" value="500KB" />

<param name="MaxBackupIndex" value="5" />

<layout class="org.apache.log4j.PatternLayout">

<param name="ConversionPattern"

value="[%d{ISO8601}] %-5p %m%n" />

</layout>

</appender>

 

<!--                          -->

<!-- Declare the SMTPAppender -->

<!--                          -->

 

<appender name="EMAIL" class="org.apache.log4j.net.SMTPAppender">

<param name="BufferSize" value="512" />

<param name="SMTPHost" value="<<>>" />

<param name="From" value="<<>>" />

<param name="To" value="<<>>" />

<param name="Subject"

value="[sMTPAppender] Log Error" />

<layout class="org.apache.log4j.PatternLayout">

<param name="ConversionPattern"

value="[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n" />

</layout>

<filter class="org.apache.log4j.varia.LevelRangeFilter">

<param name="LevelMin" value="INFO" />

<param name="LevelMax" value="FATAL" />

</filter>

</appender>

 

 

    <logger name="com.tis" additivity="false">

<level value="trace" />

<appender-ref ref="SW_ROLLING_FILE" />

<!--  appender-ref ref="file" /-->

</logger>

 

<!-- ** -->

 

<root>

<level value="ERROR" />

<appender-ref ref="STDERR" />

<appender-ref ref="EMAIL" /> 

</root>

 

 

</log4j:configuration>

 

Posted

Did you change the permissions on the folder where the logs are being stored? Tomcat doesn't run as your user, so it doesn't have permission to save stuff in your home folder unless you grant "other users" write permissions. Try making that log folder's permissions 756 instead of 750.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...