Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Log4j Problem with Multiple Application

Reply
Thread Tools

Log4j Problem with Multiple Application

 
 
the.cagatay@gmail.com
Guest
Posts: n/a
 
      01-17-2005
Hi,

I have 5 different java applications(one has main method, others are
threads) which uses log4j for logging purpose. The mechanism which is
used for to run the programs, is
A manager application starts the other applications. Each application
has its own log4j configuration file with different names.
I put root logger descreption for every file of the applications.
The manager does not have logger.
//////////////////////////////////////////////////////////////////
<root>
<priority value="DEBUG" />
<appender-ref ref="App1Appender" />
</root>

<root>
<priority value="DEBUG" />
<appender-ref ref="App2Appender" />
</root>

<root>
<priority value="DEBUG" />
<appender-ref ref="App3Appender" />
</root>

<root>
<priority value="DEBUG" />
<appender-ref ref="App4Appender" />
</root>
//////////////////////////////////////////////////////////////////

But When I did this, App1 and App2 applications did not log. I try to
remove root logger from some of the files that only one file will have
root logger description. At this point I get the error
//////////////////////////////////////////////////////////////////
log4j: No appenders could be found for category (some.category.name).
log4j: Please initialize the log4j system properly.
//////////////////////////////////////////////////////////////////
I know I must declare root loger to solve this problem but when I put
the root logger declaration to every file, some of the loggers do not
log.

In summary, I have 5 applications which have different log4j xml
configuration file. And I want each of them to be configured according
to the given file and logs correctly.
Could you suggest something to solve this problem.
Thanks

 
Reply With Quote
 
 
 
 
Bob Kranson
Guest
Posts: n/a
 
      01-18-2005
I recall theres a default log4j.properties configuration in the log4j
archive. You might want to look into that or use some of the command line
options of log4j to initialize your applications. Sounds like your
applications are properly isolated but maybe the classloader of the given
application server is losing track of which root it read last; or possible
using the included log4j default settings. Surely I read a 'comprehensive'
log4j settings post out on the 'net. Maybe just make a category for each
application to have more granular control in the long run....

HTH
Bob Kranson

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> Hi,
>
> I have 5 different java applications(one has main method, others are
> threads) which uses log4j for logging purpose. The mechanism which is
> used for to run the programs, is
> A manager application starts the other applications. Each application
> has its own log4j configuration file with different names.
> I put root logger descreption for every file of the applications.
> The manager does not have logger.
> //////////////////////////////////////////////////////////////////
> <root>
> <priority value="DEBUG" />
> <appender-ref ref="App1Appender" />
> </root>
>
> <root>
> <priority value="DEBUG" />
> <appender-ref ref="App2Appender" />
> </root>
>
> <root>
> <priority value="DEBUG" />
> <appender-ref ref="App3Appender" />
> </root>
>
> <root>
> <priority value="DEBUG" />
> <appender-ref ref="App4Appender" />
> </root>
> //////////////////////////////////////////////////////////////////
>
> But When I did this, App1 and App2 applications did not log. I try to
> remove root logger from some of the files that only one file will have
> root logger description. At this point I get the error
> //////////////////////////////////////////////////////////////////
> log4j: No appenders could be found for category (some.category.name).
> log4j: Please initialize the log4j system properly.
> //////////////////////////////////////////////////////////////////
> I know I must declare root loger to solve this problem but when I put
> the root logger declaration to every file, some of the loggers do not
> log.
>
> In summary, I have 5 applications which have different log4j xml
> configuration file. And I want each of them to be configured according
> to the given file and logs correctly.
> Could you suggest something to solve this problem.
> Thanks
>



 
Reply With Quote
 
 
 
 
gimme_this_gimme_that@yahoo.com
Guest
Posts: n/a
 
      01-20-2005
This log4j.xml file sets the root log level to error and sets the log
level for
com.something to debug :

<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration>

<appender name="FileLog" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L -
%m%n"/>
</layout>
</appender>

<category name="com.something">
<priority value="debug" />
</category>

<root>
<priority value ="error" />
<appender-ref ref="FileLog"/>
</root>

</log4j:configuration>

 
Reply With Quote
 
imrantariq imrantariq is offline
Junior Member
Join Date: Jun 2011
Posts: 2
 
      06-17-2011
Quote:
Originally Posted by (E-Mail Removed) View Post
Hi,

I have 5 different java applications(one has main method, others are
threads) which uses log4j for logging purpose. The mechanism which is
used for to run the programs, is
A manager application starts the other applications. Each application
has its own log4j configuration file with different names.
I put root logger descreption for every file of the applications.
The manager does not have logger.
//////////////////////////////////////////////////////////////////
<root>
<priority value="DEBUG" />
<appender-ref ref="App1Appender" />
</root>

<root>
<priority value="DEBUG" />
<appender-ref ref="App2Appender" />
</root>

<root>
<priority value="DEBUG" />
<appender-ref ref="App3Appender" />
</root>

<root>
<priority value="DEBUG" />
<appender-ref ref="App4Appender" />
</root>
//////////////////////////////////////////////////////////////////

But When I did this, App1 and App2 applications did not log. I try to
remove root logger from some of the files that only one file will have
root logger description. At this point I get the error
//////////////////////////////////////////////////////////////////
log4j: No appenders could be found for category (some.category.name).
log4j: Please initialize the log4j system properly.
//////////////////////////////////////////////////////////////////
I know I must declare root loger to solve this problem but when I put
the root logger declaration to every file, some of the loggers do not
log.

In summary, I have 5 applications which have different log4j xml
configuration file. And I want each of them to be configured according
to the given file and logs correctly.
Could you suggest something to solve this problem.
Thanks
Hi

Did you got success for this :

Quote:
I have 5 applications which have different log4j xml
configuration file. And I want each of them to be configured according
to the given file and logs correctly.
Could you suggest something to solve this problem.
 
Reply With Quote
 
imrantariq imrantariq is offline
Junior Member
Join Date: Jun 2011
Posts: 2
 
      06-17-2011
Did you got any success for it?

I have 5 applications which have different log4j xml
configuration file. And I want each of them to be configured according
to the given file and logs correctly.
Could you suggest something to solve this problem.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does "additivity" flag in log4j.properties work only with log4j or with Apache Commons Logging as well? Gianni Galore Java 0 09-08-2010 09:26 AM
Log4j configuration: how to suppress internal logs from Log4j? joes Java 1 08-06-2005 04:31 PM
Using log4j with Tomcat 4.1.30 problems with log4j.properties Rodolfo Java 0 07-12-2004 08:56 AM
log4j: locating log4j.proprties in same folder as jar Alex Hunsley Java 2 05-28-2004 09:57 PM
eclipse, junit, log4j, & finding log4j.xml Alexandra Stehman Java 0 01-19-2004 03:25 PM



Advertisments