Thorbjørn Ravn Andersen | 1 Apr 2010 03:06
Picon

Re: Tomcat 6 and log4j 1.2.14 - Why No Web Application Logging?

Den 31/03/10 21.22, Egan, David skrev:
> Following the instructions from here: http://tomcat.apache.org/tomcat-6.0-doc/logging.html#log4j.
> specifically the end 2nd last paragraph about config web application logging.
>
>
> My application (SOAP service) runs successfully AND logs when I run locally on my Window Tomcat 6 instance
(both to console and log file specified in log4j.properties).
>
> Migrate the SAME war file to Solaris test environment, with same
>      WEB-INF/classes/log4j.properties file
>      WEB-INF/lib/log4j-1.2.14.jar
>
> When migrated to our Solaris environment running same version of Tomcat (6.0.24) absolutely no logging
occurs.  Nothing showing in console log nor in log file specified.  It's as if it's going completely to /dev/null....
>    
Check if you have Windows file paths instead of Unix file paths in your 
configuration file.

Use lsof (if available) to see which files are actually open.

--

-- 

   Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"
WM YEOH | 1 Apr 2010 12:41
Picon

Re: Standalone instance with multiple log4j setting

Hi Ceki,

   Thank you for the guidance.

   I think I better start all over again what was the actual problem to give
you a better picture.

   I am currently upgrading the sun one apps server from 7.1 to 9.1 (in UNIX
platform), common-logging.jar, jakarta-log4j-1.2.6.jar and log4j-1.2.15.jar
are currently specified in the server classpath. The logging problem
occurred after upgraded to 9.1.

   I have an EAR file containing few jars (EJB involved) and a war file
deploying in a standalone instance. I have another war file deployed within
the same instance, meaning there are 2 apps running in one instance. When
the instance startup, there are suppose to have 2 log files, for instance
A.log and B.log. However, all the loggers only written in a single log, take
A.log as an example. Both apps have their own initServlet to load the log4j
configuration files.

   I need some answers from you in order to clear my doubts,

   - is logback my only solution?
   - can I used log4j-1.2.15 instead of slf4j-api-1.5.11?
   - I am not too sure how logback.xml is been read, initServlet triggered
   to lookup the xml file or no sevlet needed only specified in web.xml?
   - what should be the value for <env-entry-value>, just the xml file name
   or should I include the path as well like /WEB-INF/classes/xml/A1.xml
   - by looking at the logback-starwars project, it looks very simple. And I
   assume there neither to add -Dlogback.ContextSelector=JNDI nor
(Continue reading)

Ceki Gülcü | 1 Apr 2010 14:08
Picon
Gravatar

Re: Standalone instance with multiple log4j setting

On 01/04/2010 12:41 PM, WM YEOH wrote:
> Hi Ceki,
>
>     Thank you for the guidance.
>
>     I think I better start all over again what was the actual problem to give
> you a better picture.
>
>     I am currently upgrading the sun one apps server from 7.1 to 9.1 (in UNIX
> platform), common-logging.jar, jakarta-log4j-1.2.6.jar and log4j-1.2.15.jar
> are currently specified in the server classpath. The logging problem
> occurred after upgraded to 9.1.

You should not have both  jakarta-log4j-1.2.6.jar and log4j-1.2.15.jar on the 
server's class path. Pick one and only one.

>     I have an EAR file containing few jars (EJB involved) and a war file
> deploying in a standalone instance. I have another war file deployed within
> the same instance, meaning there are 2 apps running in one instance. When
> the instance startup, there are suppose to have 2 log files, for instance
> A.log and B.log. However, all the loggers only written in a single log, take
> A.log as an example. Both apps have their own initServlet to load the log4j
> configuration files.
>
>     I need some answers from you in order to clear my doubts,
>
>     - is logback my only solution?

No, logback is not your only solution. You could change the problem
setting by using non-static logger references in your EJB
(Continue reading)

WM YEOH | 1 Apr 2010 14:18
Picon

Re: Standalone instance with multiple log4j setting

Hi Ceki,

   Changing to non-static logger references in EJB is not possible. Too
risky to do so. I will go through the discussion link that you provided
shortly.

   Thank you.

Regards,
Wooi Meng

On Thu, Apr 1, 2010 at 8:08 PM, Ceki Gülcü <ceki <at> qos.ch> wrote:

> On 01/04/2010 12:41 PM, WM YEOH wrote:
>
>> Hi Ceki,
>>
>>    Thank you for the guidance.
>>
>>    I think I better start all over again what was the actual problem to
>> give
>> you a better picture.
>>
>>    I am currently upgrading the sun one apps server from 7.1 to 9.1 (in
>> UNIX
>> platform), common-logging.jar, jakarta-log4j-1.2.6.jar and
>> log4j-1.2.15.jar
>> are currently specified in the server classpath. The logging problem
>> occurred after upgraded to 9.1.
>>
(Continue reading)

Egan, David | 1 Apr 2010 15:42
Favicon

RE: Tomcat 6 and log4j 1.2.14 - Why No Web Application Logging?

Turns out the admins had copied log4j.jar into an endorsed directory (not sure if it was the Java or Tomcat endorsed)....
Removing that jar and restarting Tomcat proved the solution and now logging blissfully.

Thanks all. 

--
David Egan 
-----Original Message-----
From: Maarten Bosteels [mailto:mbosteels.dns <at> gmail.com] 
Sent: Wednesday, March 31, 2010 5:03 PM
To: Log4J Users List
Subject: Re: Tomcat 6 and log4j 1.2.14 - Why No Web Application Logging?

Try starting tomcat with the system property log4j.debug set
for example :

export TOMCAT_OPTS="-Dlog4j.debug"

IIRC, log4j will output info about which config file it's using to
standard output.

see also http://logging.apache.org/log4j/1.2/manual.html

Maarten

On Wed, Mar 31, 2010 at 9:22 PM, Egan, David <David.Egan <at> supermedia.com>wrote:

> Following the instructions from here:
> http://tomcat.apache.org/tomcat-6.0-doc/logging.html#log4j.
> specifically the end 2nd last paragraph about config web application
(Continue reading)

WM YEOH | 2 Apr 2010 09:37
Picon

Re: Standalone instance with multiple log4j setting

Hi Ceki,
 
   I have tried the Repository Selector approach but still having some output written to wrong log files. For instance, accessing A link, some info writes to B.log and the rest of the info writes to A.log.
 
   I have attached the changes that I made for your reference. A part from java, I added servlet mapping for StartUpServlet in web.xml, and remove jakarta log4j from the classpath. That's what I have done so far.
 
   I didn't make any changes to the other war application, remain as it is.
 
   Your help is utmost appreciated.
 
   Thank you.
 
Regards,
Wooi Meng
  
  

On Thu, Apr 1, 2010 at 8:08 PM, Ceki Gülcü <ceki <at> qos.ch> wrote:
On 01/04/2010 12:41 PM, WM YEOH wrote:
Hi Ceki,

   Thank you for the guidance.

   I think I better start all over again what was the actual problem to give
you a better picture.

   I am currently upgrading the sun one apps server from 7.1 to 9.1 (in UNIX
platform), common-logging.jar, jakarta-log4j-1.2.6.jar and log4j-1.2.15.jar
are currently specified in the server classpath. The logging problem
occurred after upgraded to 9.1.

You should not have both  jakarta-log4j-1.2.6.jar and log4j-1.2.15.jar on the server's class path. Pick one and only one.


   I have an EAR file containing few jars (EJB involved) and a war file
deploying in a standalone instance. I have another war file deployed within
the same instance, meaning there are 2 apps running in one instance. When
the instance startup, there are suppose to have 2 log files, for instance
A.log and B.log. However, all the loggers only written in a single log, take
A.log as an example. Both apps have their own initServlet to load the log4j
configuration files.

   I need some answers from you in order to clear my doubts,

   - is logback my only solution?

No, logback is not your only solution. You could change the problem
setting by using non-static logger references in your EJB
classes. With the simplified problem you could stick with
log4j. Having said that logback is the only platform that deals with
the logging separation problem for shared classes with static loggers.

Given that the rest of your post is logback related, I posted my full
answer on the logback-user mailing list [1]. If you wish to pursue the
logback-based solution, then please continue the discussion there.

[1] http://www.qos.ch/pipermail/logback-user/2010-April/001524.html

--
Ceki


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe <at> logging.apache.org
For additional commands, e-mail: log4j-user-help <at> logging.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe <at> logging.apache.org
For additional commands, e-mail: log4j-user-help <at> logging.apache.org
Simon Park | 2 Apr 2010 10:00
Picon
Favicon

Re: Question about using org.apache.log4j.rolling.RollingFileAppender

The TimeAndSizeRollingApender doesn't bother renaming the list of backup files and so doesn't have this
restriction.  It's freely available under the same Apache 2.0 license as Log4J at www.simonsite.org.uk.

________________________________
From: Doal Miller <Doal.Miller <at> mir3.com>
To: Log4J Users List <log4j-user <at> logging.apache.org>
Sent: Tue, 16 March, 2010 16:05:44
Subject: RE: Question about using org.apache.log4j.rolling.RollingFileAppender

Thanks for the reply. I can probably get away with using TimeBasedRollingPolicy. If not maybe I'll look
into the work you proposed. Thanks.

Doal Miller
Sr. Software Engineer

Real-Time Universal Notification & Response Technology(tm)

Direct:   858.724.1278
Cell:      760.613.6960
Email:  doal.miller <at> mir3.com

Click here to experience the MIR3 demo >

-----Original Message-----
From: Curt Arnold [mailto:curt.arnld <at> gmail.com] On Behalf Of Curt Arnold
Sent: Monday, March 15, 2010 8:27 PM
To: Log4J Users List
Subject: Re: Question about using org.apache.log4j.rolling.RollingFileAppender

On Mar 15, 2010, at 6:48 PM, Doal Miller wrote:

> I've been playing around with the RollingFileAppender out of the extra jar and I've gotten it working in a
couple of different ways but I'm not getting exactly what I want.
> 
> What I want is to roll a file when the maximum size is reached and to keep a large number of files around, like
around 250. With my following configuration file it rolls at 10,000 bytes but the
FixedWindowRollingPolicy doesn't allow me to keep over 12 files. If I try to set MaxIndex higher than 12 it
complains and resets it. I tried using the TimeBasedRollingPolicy instead, in conjunction with
SizeBasedTriggeringPolicy but I guess TimeBasedRollingPolicy uses its own triggering policy.
> 
> Is there a way to set the max number of files for the FixedWindowRollingPolicy to 250 without cracking open
the code?
> 
> Thanks in advance for any suggestions.
> 
The limit on maximum files was added since things get very slow if you rename 250 files one at a time (delete
.250, rename .249 to .250, rename .248 to .249, etc).

Renaming log files is inherently risky and platform dependent.  Writing an RFA alternative using java.nio
and avoiding renames has been on my to-do list for a long time.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe <at> logging.apache.org
For additional commands, e-mail: log4j-user-help <at> logging.apache.org

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.436 / Virus Database: 271.1.1/2745 - Release Date: 03/15/10 19:33:00

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe <at> logging.apache.org
For additional commands, e-mail: log4j-user-help <at> logging.apache.org

      
Mohan.Radhakrishnan | 5 Apr 2010 13:17
Picon

RE: RollingFileAppender not working consistently


We see the same problem. Sometimes several successive attempts to rename
fail.

Actually we also have multithreaded application and we think that one of the
threads could be writing when the file is being renamed.

We are thinking of using the DailyRollingAppender. Is that an alternative ?
--

-- 
View this message in context: http://old.nabble.com/RollingFileAppender-not-working-consistently-tp28087307p28139063.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
Mohan.Radhakrishnan | 6 Apr 2010 08:33
Picon

RE: RollingFileAppender not working consistently


Don't mean to hijack this thread.

We have a pressing need to move to DailyRollingFileAppender due to the same
problems mentioned in this thread.

Since midnight is not suitable due to heavy logging we want to use
DailyRollingFileAppender at midday or some other time. Is that possible ?

I refer
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html
--

-- 
View this message in context: http://old.nabble.com/RollingFileAppender-not-working-consistently-tp28087307p28147954.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
Peter Fuerholz | 7 Apr 2010 10:27
Picon
Favicon

Logging multiple WS client instances?

Hi there,

I have a signed WebStart application which logs defaultly into the current 
user's home directory. (If I use a relative path the log file is saved 
under a browser specific path which is not very user friendly.)
There are now cases where it is sensible to start this webstart 
application twice or more times. In this case, all program instances write 
to the same log file which makes it very difficult to read.

I came up with following two solutions:
- Put each log file into a session-specific path, e.g. 
<home>/.<application-name>/<session-id>/<filename>
  session-id must be program instance specific identifier
- Use MDC. Distinguish the different client instances by using different 
MDC-keys.
  - may be a problem using RollingFileAppender (may get messed up 
according older mailing list entry)
  - produces lot of extra data since the case, where > 1 program instance 
is running, is rather small

Is there a default behaviour how to solve this issue?

Thanks,
Peter

Gmane