1

I recently moved my application from java 1.6 to 1.8 and also changed its server from jboss eap 6 to wildfly 18. Server up and running , application is running but logs are not updating in the file.

Below is my log4j.xml - which i haven't changed at all -

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%5p [%d] (%F:%L) - %m%n" />
        </layout>
    </appender>
    <appender name="AgentMailLog4jRollingFileAppender"
        class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="/appshr/jb6-logs/agentmailClusterC/log/AgentMail.log" />
        <!-- <param name="File" value="../server/default/log/AgentMail.log" /> -->
        <!-- <param name="File" value="../logs/log/AgentMail.log" /> -->
        <param name="MaxFileSize" value="500KB" />
        <param name="MaxBackupIndex" value="10" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%5p [%d] (%F:%L) - %m%n" />
        </layout>
    </appender>
    
    <category name="com.cablevision" additivity="false">
        <priority value="debug" />
        <appender-ref ref="stdout" />
        <appender-ref ref="AgentMailLog4jRollingFileAppender" />
    </category>
    
    <root>
        <priority value="error" />
        <appender-ref ref="stdout" />
        <appender-ref ref="AgentMailLog4jRollingFileAppender" /> 
    </root>
</log4j:configuration>

What can be the reason that its not updating the file?

I tried to delete the file and rerun the application but new file didn't generated, why so? What I am missing in log4j or in wildfly?

Jens
  • 67,715
  • 15
  • 98
  • 113
Shrishti Jain
  • 31
  • 1
  • 7
  • Where is the configuration file located? – James R. Perkins Jul 21 '20 at 15:07
  • log4j.xml is present in AgentMailProject/src/log4j.xml and wildfly server configurations are all in standalone.xml and standalone-ha.xml files in wildfly-18.0.0.Final/standlone/configuration folder – Shrishti Jain Jul 22 '20 at 10:13
  • Where does it end up in your deployment though? – James R. Perkins Jul 22 '20 at 17:17
  • I am making war of the whole project and then deploying that war in my wildfly server. Here I am little confuse that do i need to enable these logging from server configurations then how and where? i checked logging.properies file in wildfly conf folder it also doesnt have enable and disable thing. – Shrishti Jain Jul 22 '20 at 18:13
  • Well you're including a log4j.xml file in your deployment right? Once it's packaged, say as a WAR, where does that log4j.xml file end up in there? – James R. Perkins Jul 22 '20 at 18:53
  • In my knowledge after deploying war log4j.xml file will check the wildfly server log4j libraries in module/org/jboss/log4j directory and i checked it have log-manager.jar present there, but yes no jar file is present in apache/log4j directory- here module.xml file says - , do I need to check here something? – Shrishti Jain Jul 23 '20 at 10:45
  • If you're using a WAR the `log4j.xml` should only need to be located in the `WAR/WEB-INF/classes` directory. If it's there then it should be picked up by the logging subsystem and processed. – James R. Perkins Jul 23 '20 at 15:52
  • I checked that too yes its present there - but still its not updating logs ? – Shrishti Jain Jul 23 '20 at 18:03
  • Are you using log4j loggers in your deployment? – James R. Perkins Jul 23 '20 at 23:21
  • log4j.xml is deployed with war itself and wildfly server read it via its jar present in module folder. Today I found very weird thing that as i produces an error knowing then Error logs not updated then in my code I am using Level.DEBUG and Level.ERROR. Debug logs are not updating .. why so? – Shrishti Jain Jul 24 '20 at 13:50
  • Without more details it's impossible to know. Any change to the log4j.xml would require a redeploy. – James R. Perkins Jul 24 '20 at 15:09

0 Answers0