1
votes

We have various mule applications deployed on our Mule 3.6.4 server all with their own log4j configuration defined in the classpath of the application as seen below. (example of 1)

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
  <Appenders>

    <Console name="console" target="SYSTEM_OUT">
      <PatternLayout
              pattern="&lt;%-4d{DATE}&gt; &lt;%-5p&gt; &lt;%t&gt; &lt;%m&gt; %n" />
    </Console>

    <RollingFile name="file"
                 fileName="${sys:mule.home}/logs/apptest.log"
                 filePattern="${sys:mule.home}/logs/apptest.%d{yyyy-MM-dd}">

      <PatternLayout
              pattern="&lt;%-4d{DATE}&gt; &lt;%-5p&gt; &lt;%t&gt; &lt;%m&gt; %n" />
      <TimeBasedTriggeringPolicy />
    </RollingFile>

  </Appenders>

  <Loggers>
    <AsyncRoot level="INFO">
      <AppenderRef ref="console" />
      <AppenderRef ref="file" />
    </AsyncRoot>
  </Loggers>

</Configuration>

And these apps are deployed in this Order in Mule ESB

Application1 Application2 Appplication3

For some reason all the logging for the applications is outputting to the console and only the log file for Application 3. The logging isn't working for Application 1 or 2?

Anyone able to shed any light on this? Is this some classloader issue? We are running Mule 3.6.4

Thanks

2

2 Answers

1
votes

Everything is going to console because you have <AppenderRef ref="console" /> in your <Logger> config. You log4j config should be at the in each {app}/classes/.

For File appender, have you tried using different file name for each application -

<RollingFile name="file"
                 fileName="${sys:mule.home}/logs/app1test.log"
                 filePattern="${sys:mule.home}/logs/app1test.%d{yyyy-MM-dd}">

For second app -

<RollingFile name="file"
                     fileName="${sys:mule.home}/logs/app2test.log"
                     filePattern="${sys:mule.home}/logs/app2test.%d{yyyy-MM-dd}">
0
votes

Have you tried using append parameter for the RollingFile appenders? You could also consider giving a unique value for the RollingFile name for each app. Something like this:

For Application1 -

<RollingFile name="app2_file"
             fileName="${sys:mule.home}/logs/app1test.log"
             filePattern="${sys:mule.home}/logs/app1test.%d{yyyy-MM-dd}" append="true">

  <PatternLayout
          pattern="&lt;%-4d{DATE}&gt; &lt;%-5p&gt; &lt;%t&gt; &lt;%m&gt; %n" />
  <TimeBasedTriggeringPolicy />
</RollingFile>

For Application2 -

<RollingFile name="file"
             fileName="${sys:mule.home}/logs/appt2est.log"
             filePattern="${sys:mule.home}/logs/app2test.%d{yyyy-MM-dd}" append="true">

  <PatternLayout
          pattern="&lt;%-4d{DATE}&gt; &lt;%-5p&gt; &lt;%t&gt; &lt;%m&gt; %n" />
  <TimeBasedTriggeringPolicy />
</RollingFile>