Tracy12 | 1 Feb 2007 01:43
Picon
Favicon

What is the best way


If I have seperate web applications running in TOMCAT, each got its own log4j
configuration.

Seems like the logging is not consistent, i.e for e.g Application A's log
messages appearing in Application B's log file.

What is the best way to overcome a situation like this.

Any articles to refer ?

Thanks
--

-- 
View this message in context: http://www.nabble.com/What-is-the-best-way-tf3152357.html#a8741064
Sent from the Log4j - Users mailing list archive at Nabble.com.
James Stauffer | 1 Feb 2007 16:02
Picon
Gravatar

Re: What is the best way

Don't put log4j.jar or your log4j config file in a shared location but
put them under each web app.  Then your logs should stay separate.

On 1/31/07, Tracy12 <j_lalith <at> yahoo.com> wrote:
>
> If I have seperate web applications running in TOMCAT, each got its own log4j
> configuration.
>
> Seems like the logging is not consistent, i.e for e.g Application A's log
> messages appearing in Application B's log file.
>
> What is the best way to overcome a situation like this.
>
> Any articles to refer ?
>
> Thanks
> --
> View this message in context: http://www.nabble.com/What-is-the-best-way-tf3152357.html#a8741064
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe <at> logging.apache.org
> For additional commands, e-mail: log4j-user-help <at> logging.apache.org
>
>

--

-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
(Continue reading)

Jacob Kjome | 1 Feb 2007 17:40
Favicon

Re: What is the best way

Quoting James Stauffer <stauffer.james <at> gmail.com>:

> Don't put log4j.jar or your log4j config file in a shared location but
> put them under each web app.  Then your logs should stay separate.
>

Or use a RepositorySelector implementation, but that's way more complicated than
 what James suggests.

Actually, you can have log4j.jar and a config file in a shared location (such as
common/lib to have Tomcat log using Log4j) as long as you **also** include
log4j.jar in WEB-INF/lib and the config file in WEB-INF/classes of each webapp.
 Note that the config file should be a log4j.xml file.  If it isn't, Log4j in
your webapp will look to a parent classloader to look for one.  If it finds it,
it almost certainly won't be the one you want.  If you perform manual
configuration, at least put a dummy minimal log4j.xml file in WEB-INF/classes
so that autoconfiguration doesn't pick up some arbitrary config file.

Jake

> On 1/31/07, Tracy12 <j_lalith <at> yahoo.com> wrote:
> >
> > If I have seperate web applications running in TOMCAT, each got its own
> log4j
> > configuration.
> >
> > Seems like the logging is not consistent, i.e for e.g Application A's log
> > messages appearing in Application B's log file.
> >
> > What is the best way to overcome a situation like this.
(Continue reading)

Todd Nine | 1 Feb 2007 19:08
Picon

Help with DailyRollingFileAppender

Hi all,
  I'm having some trouble with DailyRollingFileAppender.  I'm using log4j
1.2.14, and I'm trying to get the logs to roll at midnight.  I perform the
following steps to test log rolling, and they don't appear to be creating
the new logs correct.

   1. I start Tomcat, perform some requests to generate some log data
   2. Stop tomcat
   3. Set my system date to tomorrow
   4. Restart Tomcat and perform more requests to generate logging.

However, the logs don't roll in step 4 as I expect them to.  I have included
my log4j.xml, any help would be greatly appreciated.

Thanks,
Todd

<log4j:configuration>
    <appender name="TOMCAT" class="org.apache.log4j.DailyRollingFileAppender
">
        <param name="File" value="${catalina.home}/logs/tomcat.log."/>
        <param name="DatePattern" value="'.'yyyy-MM-dd"/>
        <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} [%t]
%-5p  %c - %m%n"/>
        </layout>
    </appender>

    <appender name="OLB" class="org.apache.log4j.DailyRollingFileAppender">

(Continue reading)

James Stauffer | 1 Feb 2007 19:27
Picon
Gravatar

Re: Help with DailyRollingFileAppender

It may only roll if it isn't stopped.  In order for your test to work
log4j would have to look in the log file to see when the last log was
written or check the modified date of the log file.

On 2/1/07, Todd Nine <todd.nine <at> gmail.com> wrote:
> Hi all,
>   I'm having some trouble with DailyRollingFileAppender.  I'm using log4j
> 1.2.14, and I'm trying to get the logs to roll at midnight.  I perform the
> following steps to test log rolling, and they don't appear to be creating
> the new logs correct.
>
>
>    1. I start Tomcat, perform some requests to generate some log data
>    2. Stop tomcat
>    3. Set my system date to tomorrow
>    4. Restart Tomcat and perform more requests to generate logging.
>
> However, the logs don't roll in step 4 as I expect them to.  I have included
> my log4j.xml, any help would be greatly appreciated.
>
> Thanks,
> Todd
>
> <log4j:configuration>
>     <appender name="TOMCAT" class="org.apache.log4j.DailyRollingFileAppender
> ">
>         <param name="File" value="${catalina.home}/logs/tomcat.log."/>
>         <param name="DatePattern" value="'.'yyyy-MM-dd"/>
>         <layout class="org.apache.log4j.PatternLayout">
>              <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} [%t]
(Continue reading)

Eqbal | 2 Feb 2007 03:33
Picon
Favicon

Re: question mark displayed for certain patterns

Okay. It was a compile issue as I was using ant and
compiling with no debug flag so it defaulted to off.
The issue is resolved, thanks for your help.
--- Curt Arnold <carnold <at> apache.org> wrote:

> 
> On Jan 29, 2007, at 5:08 PM, Eqbal wrote:
> 
> > Hi,
> >
> > I am fairly new to log4j. I am experiencing a
> problem
> > when configuring log4j in Tomcat and use it
> through
> > commons logging framework. I get a ? (question
> mark)
> > in place of %F and %L patterns. When I run a Java
> > class file as a standalone using "main", I get the
> > proper file name and line number. But when I run
> the
> > web application I get a question mark in the
> console.
> > Anyone can tell me what I am doing wrong?
> >
> > Thanks.
> >
> 
> That behavior is expected when the calling class is
> compiled without  
> debug information (like using javac -g:none). 
(Continue reading)

e120281 | 2 Feb 2007 09:15
Picon
Favicon

log4j+kiwi syslog+tcp


i am using kiwi syslog and log4j 1.2.14
below is the xml conf. for syslog.
by this configuration log4j use udp to conncet to the deamon.
i eanble the tcp port of kiwi but i donot know how to say log4j to send
messages over tcp.

	<appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender"> 
		<param name="syslogHost" value="tcp://localhost:9500" />
		<param name="threshold" value="debug" />
		<layout class="org.apache.log4j.PatternLayout"> 
			<param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/> 
		</layout> 
	</appender> 
--

-- 
View this message in context: http://www.nabble.com/log4j%2Bkiwi-syslog%2Btcp-tf3159611.html#a8763220
Sent from the Log4j - Users mailing list archive at Nabble.com.
Todd Nine | 2 Feb 2007 15:59
Picon

Re: Help with DailyRollingFileAppender

Thanks for the reply, so are you saying that log4j will only roll the log if
its running at exactly Midnight?

On 2/1/07, James Stauffer <stauffer.james <at> gmail.com> wrote:
>
> It may only roll if it isn't stopped.  In order for your test to work
> log4j would have to look in the log file to see when the last log was
> written or check the modified date of the log file.
>
> On 2/1/07, Todd Nine <todd.nine <at> gmail.com> wrote:
> > Hi all,
> >   I'm having some trouble with DailyRollingFileAppender.  I'm using
> log4j
> > 1.2.14, and I'm trying to get the logs to roll at midnight.  I perform
> the
> > following steps to test log rolling, and they don't appear to be
> creating
> > the new logs correct.
> >
> >
> >    1. I start Tomcat, perform some requests to generate some log data
> >    2. Stop tomcat
> >    3. Set my system date to tomorrow
> >    4. Restart Tomcat and perform more requests to generate logging.
> >
> > However, the logs don't roll in step 4 as I expect them to.  I have
> included
> > my log4j.xml, any help would be greatly appreciated.
> >
> > Thanks,
(Continue reading)

Todd Nine | 2 Feb 2007 16:03
Picon

Re: Help with DailyRollingFileAppender

Sorry, hit send prematurely.  I have this log4j.xml running on our
production Tomcat server, and the logs don't roll at midnight.  Am I missing
some configuration parameter?  According to the javadocs, I thought I had
supplied all of the required parameters.

Thanks,
Todd

On 2/1/07, James Stauffer <stauffer.james <at> gmail.com> wrote:
>
> It may only roll if it isn't stopped.  In order for your test to work
> log4j would have to look in the log file to see when the last log was
> written or check the modified date of the log file.
>
> On 2/1/07, Todd Nine <todd.nine <at> gmail.com> wrote:
> > Hi all,
> >   I'm having some trouble with DailyRollingFileAppender.  I'm using
> log4j
> > 1.2.14, and I'm trying to get the logs to roll at midnight.  I perform
> the
> > following steps to test log rolling, and they don't appear to be
> creating
> > the new logs correct.
> >
> >
> >    1. I start Tomcat, perform some requests to generate some log data
> >    2. Stop tomcat
> >    3. Set my system date to tomorrow
> >    4. Restart Tomcat and perform more requests to generate logging.
> >
(Continue reading)

James Stauffer | 2 Feb 2007 16:10
Picon
Gravatar

Re: Help with DailyRollingFileAppender

I would only expect it to roll if it logs something both before and
after midnight without being restarted.  But I don't know if it is
smart enough to handle other situations.

On 2/2/07, Todd Nine <todd.nine <at> gmail.com> wrote:
> Thanks for the reply, so are you saying that log4j will only roll the log if
> its running at exactly Midnight?
>
> On 2/1/07, James Stauffer <stauffer.james <at> gmail.com> wrote:
> >
> > It may only roll if it isn't stopped.  In order for your test to work
> > log4j would have to look in the log file to see when the last log was
> > written or check the modified date of the log file.
> >
> > On 2/1/07, Todd Nine <todd.nine <at> gmail.com> wrote:
> > > Hi all,
> > >   I'm having some trouble with DailyRollingFileAppender.  I'm using
> > log4j
> > > 1.2.14, and I'm trying to get the logs to roll at midnight.  I perform
> > the
> > > following steps to test log rolling, and they don't appear to be
> > creating
> > > the new logs correct.
> > >
> > >
> > >    1. I start Tomcat, perform some requests to generate some log data
> > >    2. Stop tomcat
> > >    3. Set my system date to tomorrow
> > >    4. Restart Tomcat and perform more requests to generate logging.
> > >
(Continue reading)


Gmane