Go Back   Java Programming Forums > Java EE (Enterprise Edition) > Web Frameworks


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 14-01-2010, 05:24 AM
Junior Member
 

Join Date: Jan 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
arttaras is on a distinguished road
Default Glassfish + log4j + multiple log4j.xml

Hi all!
Situation:
Application Server: Glassfish v.2.1
OS: Windows XP
Number of application in domain: 3 independent applications
Each application contains ejb and web module.

Task: to organize logging policy:each application has its own log-file.

Internet "tells" me a solution (on server side):
1) place log4j.jar into .../domains/domain1/lib
2) for each application create its own log4j.xml (configuration file) and place it in WEB-INF/classes folder
3) restart the server

How I did it:

1) clear
2) xml for first application (named 'fsvps')

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<appender name="fileLogger" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="../logs/fsvps.log" />
<param name="encoding" value="UTF-8" />
<param name="MaxFileSize" value="2000KB"/>
<param name="MaxBackupIndex" value="10"/>
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%p %t %c - %m%n"/>
</layout>
</appender>
<logger name="fsvps" additivity="false">
<level value="trace"/>
<appender-ref ref="fileLogger"/>
</logger>
<root>
<level value ="trace"/>
<appender-ref ref="fileLogger"/>
</root>
</log4j:configuration>

for other applications xml is the same but I changed fsvps.log to fsvps-rpt.log and fsvps-losts.log accordingly and I changed name of logger to fsvps-rpt and fsvps-losts accordingly.

Note:First application uses freemarker
Other 2 (fsvps-rpt, fsvps-losts) dont't use freemarker

3) When I restart the server and go to the log directory I find the fsvps.log file (as I expect). From Freemarker manual:

"FreeMarker integrates with the following logging packages: Log4J, Avalon LogKit, and java.util.logging (Java2 platform 1.4 and above). You need not do anything in order for FreeMarker to use these loggers; if any of them is discovered through the class loader that loaded FreeMarker classes, it is used automatically. All log messages produced by FreeMarker are logged into the logger hierarchy whose top-level logger is named freemarker."

But I can't find other 2 files in the same directory. And in the server.log I find:

[#|2010-01-13T16:06:15.859+0300|INFO|sun-appserver2.1|org.apache.catalina.loader.WebappLoad er|_ThreadID=15;_ThreadName=pool-1-thread-2;|Unknown loader Application library chain for fsvps-rpt parentCL :: EJBClassLoader :
urlSet = []
doneCalled = false
Parent -> java.net.URLClassLoader@137d4a4
constituent CLs ::
:: null :: optionalChain
class com.sun.appserv.server.util.ClassLoaderChain|#]

Next. If I undeploy fsvps and restart server I find again 1 file - fsvps-losts.log or fsvps-rpt.log, depending on what application I addressed to first.

How can I resolve my problem and achieve the main goal? I've been skirmishing for solution more than 2 days (



Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
Reply

Tags
glassfish, log4j

Thread Tools
Display Modes

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 On



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Queues fh84 Threads 1 03-12-2009 06:28 PM
Reading from a file, multiple lines MysticDeath File I/O & Other I/O Streams 5 15-10-2009 07:40 AM
traversing multiple jTabbedPane? dewboy3d AWT / Java Swing 3 03-10-2009 12:26 AM
Breaking out of multiple loops helloworld922 Loops & Control Statements 4 01-07-2009 07:52 PM
Another multiple choice..... abhishekraok2003 Java Theory & Questions 1 16-05-2009 03:17 PM


100 most searched terms
Search Cloud
2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

All times are GMT. The time now is 01:57 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.