I have pack: mypack.myclass
in jboss(3.2.1) I configure 2 shedulers, which call myclass method but with different parameters (parameters define log4j category for this sheduler)
scheduler-service.xml :
<mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler1">
...
<attribute name="SchedulableClass">mypack.myclass</attribute>
<attribute name="SchedulableArguments">paramValue1</attribute>
<attribute name="SchedulableArgumentTypes">java.lang.String</attribute>
....
</mbean>
<mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler2">
...
<attribute name="SchedulableClass">mypack.myclass</attribute>
<attribute name="SchedulableArguments">paramValue2</attribute>
<attribute name="SchedulableArgumentTypes">java.lang.String</attribute>
....
</mbean>
In mypack.myclass constructor I initialize log4j category, depending on input parameter:
public class myclass{
protected static Logger log;
public myclass(String log4jcategory) {
log = Logger.getLogger(log4jCategory);
}
....
}
in file all\conf\log4j.xml I describe this two categories:
<appender name="LOG1" class="org.jboss.logging.appender.DailyRollingFileAppender">
....
</appender>
<appender name="LOG2" class="org.jboss.logging.appender.DailyRollingFileAppender">
....
</appender>
<category name="paramValue1">
<appender-ref ref="LOG1"/>
...
</category>
<category name="paramValue2">
<appender-ref ref="LOG2"/>
...
</category>
But as a result, when sheduler starts .... from the begining log4j puts logdata into 2 different files, but at the 3-d itteration of sheduler all data writes to one file. And this one file choose randomly.
Why logdata is writtn to one log?