Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
|
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2008, 08:40 PM
Registered User
 
Join Date: Apr 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Log4j load balanced tomcat pointing same webapp

hi everyone,

sorry if i post on the wrong forum, but can't find any thread on log4j specifically.
i faced with a rather weird outcome of log4j. first of all to load preface information,
i'm using apache2.2 and load balanced 2 tomcat version 6 called tomcat1 & tomcat2 respectively. i made the tomcat1 & 2
point to a single webapp directory.

rough diagram looks like this:

     Apache2.2
         |
     ---------
     | |
  tomcat1 tomcat2
    | |
    -------------
          |
       webapps

as depicted above, any request send from apache to tomcat1 and
tomcat2 will use the same copy of servlet within the webapps/WEB-INF/classes dir. i set the log file to eg. "/log/mylog.log". the log4j settings is as below.

--------------------------------
<p>
log4j.rootLogger =DEBUG,DAILY
log4j.appender.DAILY=org.apache.log4j.DailyRolling FileAppender
log4j.appender.DAILY.layout=org.apache.log4j.Patte rnLayout
log4j.appender.DAILY.File=/log/mylog.log
log4j.appender.DAILY.Append=true

log4j.appender.DAILY.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.DAILY.layout.ConversionPattern=%d %-5p [%t] %-17c{2} %3x - %m%n
</p>

based on the setting above, it should log every top hour
per file.

There are 2 problems i'm facing now:
1.
It logs every hour as expected. But the name of the file
where hour indicated differently than the contents being log.
   eg. filename is "mylog.log.2008-04-20-13" indicate 1pm.
       but the contents inside logs 2pm onwards.

2.
Log4j normally rollover and copy a new past hour to a new file. Leaving the default mylog.log as the current logging data before rollover and copy to another file (that is, currently logging 2pm onwards). But i saw it
logging both files at the same time in "mylog.log" and "mylog.log.2008-04-20-13". The file "mylog.log" logging 2pm onwards which is correct but it still log 2pm onwards /append the same information to "mylog.log.2008-04-20-13".

i suspect it might be something to do with concurrency/thread issue while logging the file.

+has anyone ever come across any of this?
+did i not do correctly on the log settings?
+can DailyRollingFileAppender actually handle this rollover issue?

please, this is rather headache to me and anyone would be kind enough to give me a pointer to overcome this. Thanks.

Wesley








Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to Load Tomcat Correctly !!! HELP sahil.ansari JSP Basics 1 August 28th, 2008 07:04 AM
Apache tomcat load clustering problem abcprocure Apache Tomcat 0 May 30th, 2008 06:04 AM
well balanced xml aowss XSLT 3 January 25th, 2006 04:35 AM
load issue on tomcat nidhik Pro JSP 0 November 17th, 2005 04:13 AM
Pointing a Sub-form to a particular record. Sibrovvs Access VBA 3 November 17th, 2004 01:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.