Tomcat log4j vs MySQL

2014-04-07 Thread Арсений Зинченко
Hi.

Question are not exactly about Tomcat - but I hope somebody can help with
it.

So - we have Tomcat running. Apllication in it use log4j to write logs.

log4j configured to use syslogd daemon and syslogd uses MySQL to store logs.

Problem is that when we have any error in log - it writes it with newlines
when at in trace added.

For example:

14-03-24 13:49:59,574+0200  1641034 ERROR [com***l]
(http-8443-Processor25:CN=setevoy, OU=Unknown, O=Unknown, L=Unknown,
ST=Unknown, C=Unknown:10.***.***.15) Error in finding user: 'CN=setevoy,
OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown'
org.s***.EmptyResultDataAccessException: Incorrect result size: expected 1,
actual 0
at org.***(***.java:1520)
at com.***(***.java:288)
at sun.***0(Native Method)

Then - in database table its added again with newlines fro every at'
element and, as it new line, it's added it with new entry for every line.

So tables looks like (this other error trace, not from example above):

mysql select ID,Message from SystemEvents order by ID desc limit
60;...| 258433 | at java.lang.Thread.run(Thread.java:662)
| 258432 |
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
  | 258431 | at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
| 258430 | at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:541)


Instead of add error entirely in one cell of table.

Could it be reconfigured someway?

Thanks.


Re: [OT] Tomcat log4j vs MySQL

2014-04-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Арсений,

On 4/7/14, 4:18 AM, Арсений Зинченко wrote:
 Hi.
 
 Question are not exactly about Tomcat - but I hope somebody can
 help with it.
 
 So - we have Tomcat running. Apllication in it use log4j to write
 logs.
 
 log4j configured to use syslogd daemon and syslogd uses MySQL to
 store logs.
 
 Problem is that when we have any error in log - it writes it with
 newlines when at in trace added.
 
 For example:
 
 14-03-24 13:49:59,574+0200  1641034 ERROR [com***l] 
 (http-8443-Processor25:CN=setevoy, OU=Unknown, O=Unknown,
 L=Unknown, ST=Unknown, C=Unknown:10.***.***.15) Error in finding
 user: 'CN=setevoy, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown,
 C=Unknown' org.s***.EmptyResultDataAccessException: Incorrect
 result size: expected 1, actual 0 at org.***(***.java:1520) at
 com.***(***.java:288) at sun.***0(Native Method)
 
 Then - in database table its added again with newlines fro every
 at' element and, as it new line, it's added it with new entry for
 every line.
 
 So tables looks like (this other error trace, not from example
 above):
 
 mysql select ID,Message from SystemEvents order by ID desc limit 
 60;...| 258433 | at java.lang.Thread.run(Thread.java:662) |
 258432 | at
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)

 
| 258431 | at
 org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)

 
| 258430 | at
 org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:541)

 
 
 Instead of add error entirely in one cell of table.
 
 Could it be reconfigured someway?

I think this is just one of the caveats of using log4j + syslog. You
should probably ask the folks at log4j or guidance.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTQu+zAAoJEBzwKT+lPKRYM2cP/i/CbnVym1znfRZRAj5jfGjS
lVHAWLHxJ6VAUKFoGQfN41gM8fv0ZhFqMQSesw/L0mxHH1f+dgJLYOhRliocFVBa
OTBJ4lXK/9hgPCZL4utXVnc3f4Xz/odrpMJCLjB3n4TABn78EghRuqH6n8ToNvmp
7iV8tisM/3MjUHxetrhlurYM42NjyP9XwPfKrUe8MXmU4SUZXQ6tuiGOws8OTYj/
d09LSkHdHwYiMcvDOLCSw+kBzYegAp7uotwfuxQJuiFJVXGgwURwvAHx5VdB5Zbz
Y4oRn3d6DOtZ42gWmTD+6AT3gmMuw8Y7zGqLgeH2N3+lvGSt0uA8gpqUcG23YCIK
QKuKUtKunrQVItwE6SSWFMue5aMbnMRxcT9Tx599yhW/DJKLAyZ1jloFN6eO3wWc
HbE9h29NxhCPx+q3QmOAZ84nK6RcYSr8hbNzlAi6M7uBehLJgXUVlFx2HxnlwHHu
hE+o8+/wpWV+yqNdrva1AcK78rqx1Tnj0IenYpUdi8rZFP1oEPotP4SOHIdVGQsf
jDYHadxkPaV0xCfcAAbQ3RkR7WEnhZMrkuB/TkwyWy/M98Fb8IjWtIuqPpzyEmky
WQBjKhX7X5+KBcivQGMJcZtfRo01+szJcHPFSo2rn3y+zw9KwMql7229t81pNuad
ua4a0dEPjngkfqCvyFrT
=FGhe
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



tomcat/log4j

2007-01-19 Thread Zhanyang Zhu

Hi There,

I am having a problem with my application. When I develop the application
to one of the test server, I got the following error. But I also tested on
three other servers. It worked fine. Any one know what it is wrong? Is the
log4j set up at the tomcat server wrong? and where is it wrong if know?

many thanks



Zhanyang


The error message---
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it
from fulfilling this request.

exception

java.lang.NullPointerException
org.apache.log4j.spi.LocationInfo.init(LocationInfo.java:95)

org.apache.log4j.spi.LoggingEvent.getLocationInformation(LoggingEvent.java:182)

org.apache.log4j.helpers.PatternParser$LocationPatternConverter.convert(PatternParser.java:475)

org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:56)
org.apache.log4j.PatternLayout.format(PatternLayout.java:495)
org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:292)
org.apache.log4j.WriterAppender.append(WriterAppender.java:150)
org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)

org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
org.apache.log4j.Category.callAppenders(Category.java:187)
org.apache.log4j.Category.forcedLog(Category.java:372)
org.apache.log4j.Category.log(Category.java:864)
org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:110)

org.iedb.eptopdbtool.EpToPDBAdminServlet.service(EpToPDBAdminServlet.java:52)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.17 logs.



Zhanyang/SDSC





-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat Log4j

2006-12-08 Thread Dirk Wierdemann
 to that classical
  question... (other than 42, of course ;-).
 
  Thanx a lot and excuse me for my poor English, I'm a little froggie.
 
 
  Pierre
 


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 -- 
 L'une des raisons pour lesquelles la vie est complexe
 C'est qu'elle a une partie réelle et une partie imaginaire.
 
 

-- 
View this message in context: 
http://www.nabble.com/Tomcat---Log4j-tf2686289.html#a7757221
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat Log4j

2006-11-23 Thread David Smith
I've read the entire thread and decided to go back to the original post 
for a re-read.


Have you considered the possibility that your tomcat (or wtp) install 
has suffered some corruption during the HD crash?  You might want to try 
backing up the current setup, then re-install and add back in your 
webapp and other customizations.  Test at various places along the way 
until it all works or breaks.  If a fresh install works and then breaks 
after adding something back in, you've found the issue.


As to the location of log4j.properties, the ideal is to place one for 
the server in server/classes for tomcat's internal classloader and one 
in each webapp's WEB-INF/classes folder for each webapp's logging.  If 
you place log4j.properties in common/lib, it becomes the log4j config 
for all of tomcat -- the server's internal working and your webapps.


I would recommend you don't mess with trying to set classpath for tomcat 
unless you absolutely have to.


--David

Pierre Goupil wrote:

Hi all !

I once had a Tomcat 5.5 and an Eclipse 3.2 that where running just 
fine and
then... the HDD crashed... I suffered no data lost but since then, I 
can't

start Tomcat anymore. The server view of Eclipse gives me the following
trace :



Exception in thread main java.lang.ExceptionInInitializerError
Caused by: com.sun.org.apache.commons.logging.LogConfigurationException:
com.sun.org.apache.commons.logging.LogConfigurationException :
java.lang.NullPointerException (Caused by java.lang.NullPointerException)
(Caused by com.sun.org.apache.commons.logging.LogConfigurationException:
java.lang.NullPointerException (Caused by 
java.lang.NullPointerException ))

   at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
LogFactoryImpl.java:543)
   at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
LogFactoryImpl.java:235)
   at 
com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance (

LogFactoryImpl.java:209)
   at 
com.sun.org.apache.commons.logging.LogFactory.getLog(LogFactory.java

:351)
   at org.apache.catalina.startup.Bootstrap.clinit(Bootstrap.java:73)
Caused by: com.sun.org.apache.commons.logging.LogConfigurationException :
java.lang.NullPointerException (Caused by java.lang.NullPointerException)
   at
com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
LogFactoryImpl.java:397)
   at 
com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance (

LogFactoryImpl.java:529)
   ... 4 more
Caused by: java.lang.NullPointerException
   at
com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
LogFactoryImpl.java:374)
   ... 5 more


I eventually felt into Commons-logging / Log4j neighborhood jam ! The log
system of my servlet (Log4j) doesn't work anymore, but I don't bother
because it doesn't start anyway. But, regarding Tomcat's log system
re-launching, it's an usual concern : lots of people talk about that. But
neither them nor me can find a solution. Of course I've found a lot of
tutorials, but they can't help...

I have re-installed my workstation, indeed.

I've tried to launch Tomcat via another plugin, too. I gave Sysdeo a 
try :

Tomcat runs, loads the servlet, but doesn't run it and keeps quiet. No
servlet log, no exception, no result (resource unavailable).

If someone could help me find a definitive answer to that classical
question... (other than 42, of course ;-).

Thanx a lot and excuse me for my poor English, I'm a little froggie.


Pierre




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat Log4j

2006-11-23 Thread Pierre Goupil

Hi !

Inline

2006/11/23, David Smith [EMAIL PROTECTED]:


I've read the entire thread and decided to go back to the original post
for a re-read.



Yes, thank you !



Have you considered the possibility that your tomcat (or wtp) install

has suffered some corruption during the HD crash?  You might want to try
backing up the current setup, then re-install and add back in your
webapp and other customizations.  Test at various places along the way
until it all works or breaks.  If a fresh install works and then breaks
after adding something back in, you've found the issue.



I'm gonna try this. In fact, this is the first thing I should have done.
Thank you for the advice !

Regards,

Pierre


--
L'une des raisons pour lesquelles la vie est complexe
C'est qu'elle a une partie réelle et une partie imaginaire.


Re: Tomcat Log4j

2006-11-23 Thread Pierre Goupil

Hi !

No, still no way. After a complete re-install I've put a
log4j.propertiesalternatively in all the places you all told me to,
but it does nothing :
still the same exception...

Here's the file :

* * * * * * *
*
#définition du niveau et des Appender du rootLogger
log4j.rootLogger=WARN,anAppender

#configuration de monAppender
#nous allons envoyer les messages dans la console de Tomcat
log4j.appender.anAppender=org.apache.log4j.ConsoleAppender

#définition du Layout pour monAppender
log4j.appender.anAppender.layout=org.apache.log4j.PatternLayout

#définition du pattern d'affichage pour monAppender
#voici un exemple de sortie que l'on va obtenir : 2005-06-18 14:53:37 DEBUG
[Main] Hello World
log4j.appender.anAppender.layout.ConversionPattern=%d{MM-dd HH:mm:ss} %-5p
[%c{1}] %m%n
* * * * * * *
*

I've found it in a tuto, so I guess it's corrct.

At this point I'm starting to think to a
com.sun.org.apache.commons.loggingbug...


Regards,

Pierre



2006/11/23, David Smith [EMAIL PROTECTED]:


I've read the entire thread and decided to go back to the original post
for a re-read.

Have you considered the possibility that your tomcat (or wtp) install
has suffered some corruption during the HD crash?  You might want to try
backing up the current setup, then re-install and add back in your
webapp and other customizations.  Test at various places along the way
until it all works or breaks.  If a fresh install works and then breaks
after adding something back in, you've found the issue.

As to the location of log4j.properties, the ideal is to place one for
the server in server/classes for tomcat's internal classloader and one
in each webapp's WEB-INF/classes folder for each webapp's logging.  If
you place log4j.properties in common/lib, it becomes the log4j config
for all of tomcat -- the server's internal working and your webapps.

I would recommend you don't mess with trying to set classpath for tomcat
unless you absolutely have to.

--David

Pierre Goupil wrote:
 Hi all !

 I once had a Tomcat 5.5 and an Eclipse 3.2 that where running just
 fine and
 then... the HDD crashed... I suffered no data lost but since then, I
 can't
 start Tomcat anymore. The server view of Eclipse gives me the
following
 trace :


 
 Exception in thread main java.lang.ExceptionInInitializerError
 Caused by: com.sun.org.apache.commons.logging.LogConfigurationException:
 com.sun.org.apache.commons.logging.LogConfigurationException :
 java.lang.NullPointerException (Caused by java.lang.NullPointerException
)
 (Caused by com.sun.org.apache.commons.logging.LogConfigurationException:
 java.lang.NullPointerException (Caused by
 java.lang.NullPointerException ))
at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance
(
 LogFactoryImpl.java:543)
at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance
(
 LogFactoryImpl.java:235)
at
 com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance (
 LogFactoryImpl.java:209)
at
 com.sun.org.apache.commons.logging.LogFactory.getLog(LogFactory.java
 :351)
at org.apache.catalina.startup.Bootstrap.clinit(Bootstrap.java:73)
 Caused by: com.sun.org.apache.commons.logging.LogConfigurationException:
 java.lang.NullPointerException (Caused by java.lang.NullPointerException
)
at
 com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor
(
 LogFactoryImpl.java:397)
at
 com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance (
 LogFactoryImpl.java:529)
... 4 more
 Caused by: java.lang.NullPointerException
at
 com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor
(
 LogFactoryImpl.java:374)
... 5 more
 

 I eventually felt into Commons-logging / Log4j neighborhood jam ! The
log
 system of my servlet (Log4j) doesn't work anymore, but I don't bother
 because it doesn't start anyway. But, regarding Tomcat's log system
 re-launching, it's an usual concern : lots of people talk about that.
But
 neither them nor me can find a solution. Of course I've found a lot of
 tutorials, but they can't help...

 I have re-installed my workstation, indeed.

 I've tried to launch Tomcat via another plugin, too. I gave Sysdeo a
 try :
 Tomcat runs, loads the servlet, but doesn't run it and keeps quiet. No
 servlet log, no exception, no result (resource unavailable).

 If someone could help me find a definitive answer to that classical
 question... (other than 42, of course ;-).

 Thanx a lot and excuse me for my poor English, I'm a little froggie.


 Pierre



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
L'une des raisons pour lesquelles la vie 

Tomcat Log4j

2006-11-22 Thread Pierre Goupil

Hi all !

I once had a Tomcat 5.5 and an Eclipse 3.2 that where running just fine and
then... the HDD crashed... I suffered no data lost but since then, I can't
start Tomcat anymore. The server view of Eclipse gives me the following
trace :



Exception in thread main java.lang.ExceptionInInitializerError
Caused by: com.sun.org.apache.commons.logging.LogConfigurationException:
com.sun.org.apache.commons.logging.LogConfigurationException :
java.lang.NullPointerException (Caused by java.lang.NullPointerException)
(Caused by com.sun.org.apache.commons.logging.LogConfigurationException:
java.lang.NullPointerException (Caused by java.lang.NullPointerException ))
   at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
LogFactoryImpl.java:543)
   at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
LogFactoryImpl.java:235)
   at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance (
LogFactoryImpl.java:209)
   at com.sun.org.apache.commons.logging.LogFactory.getLog(LogFactory.java
:351)
   at org.apache.catalina.startup.Bootstrap.clinit(Bootstrap.java:73)
Caused by: com.sun.org.apache.commons.logging.LogConfigurationException :
java.lang.NullPointerException (Caused by java.lang.NullPointerException)
   at
com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
LogFactoryImpl.java:397)
   at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance (
LogFactoryImpl.java:529)
   ... 4 more
Caused by: java.lang.NullPointerException
   at
com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
LogFactoryImpl.java:374)
   ... 5 more


I eventually felt into Commons-logging / Log4j neighborhood jam ! The log
system of my servlet (Log4j) doesn't work anymore, but I don't bother
because it doesn't start anyway. But, regarding Tomcat's log system
re-launching, it's an usual concern : lots of people talk about that. But
neither them nor me can find a solution. Of course I've found a lot of
tutorials, but they can't help...

I have re-installed my workstation, indeed.

I've tried to launch Tomcat via another plugin, too. I gave Sysdeo a try :
Tomcat runs, loads the servlet, but doesn't run it and keeps quiet. No
servlet log, no exception, no result (resource unavailable).

If someone could help me find a definitive answer to that classical
question... (other than 42, of course ;-).

Thanx a lot and excuse me for my poor English, I'm a little froggie.


Pierre

--
L'une des raisons pour lesquelles la vie est complexe
C'est qu'elle a une partie réelle et une partie imaginaire.


Re: Tomcat Log4j

2006-11-22 Thread olivier nouguier

Hi pierre,
Simply what is your question ?
Did you try wtp ?


On 11/22/06, Pierre Goupil [EMAIL PROTECTED] wrote:

Hi all !

I once had a Tomcat 5.5 and an Eclipse 3.2 that where running just fine and
then... the HDD crashed... I suffered no data lost but since then, I can't
start Tomcat anymore. The server view of Eclipse gives me the following
trace :



Exception in thread main java.lang.ExceptionInInitializerError
Caused by: com.sun.org.apache.commons.logging.LogConfigurationException:
com.sun.org.apache.commons.logging.LogConfigurationException :
java.lang.NullPointerException (Caused by java.lang.NullPointerException)
(Caused by com.sun.org.apache.commons.logging.LogConfigurationException:
java.lang.NullPointerException (Caused by java.lang.NullPointerException ))
at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
LogFactoryImpl.java:543)
at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
LogFactoryImpl.java:235)
at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getInstance (
LogFactoryImpl.java:209)
at com.sun.org.apache.commons.logging.LogFactory.getLog(LogFactory.java
:351)
at org.apache.catalina.startup.Bootstrap.clinit(Bootstrap.java:73)
Caused by: com.sun.org.apache.commons.logging.LogConfigurationException :
java.lang.NullPointerException (Caused by java.lang.NullPointerException)
at
com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
LogFactoryImpl.java:397)
at com.sun.org.apache.commons.logging.impl.LogFactoryImpl.newInstance (
LogFactoryImpl.java:529)
... 4 more
Caused by: java.lang.NullPointerException
at
com.sun.org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
LogFactoryImpl.java:374)
... 5 more


I eventually felt into Commons-logging / Log4j neighborhood jam ! The log
system of my servlet (Log4j) doesn't work anymore, but I don't bother
because it doesn't start anyway. But, regarding Tomcat's log system
re-launching, it's an usual concern : lots of people talk about that. But
neither them nor me can find a solution. Of course I've found a lot of
tutorials, but they can't help...

I have re-installed my workstation, indeed.

I've tried to launch Tomcat via another plugin, too. I gave Sysdeo a try :
Tomcat runs, loads the servlet, but doesn't run it and keeps quiet. No
servlet log, no exception, no result (resource unavailable).

If someone could help me find a definitive answer to that classical
question... (other than 42, of course ;-).

Thanx a lot and excuse me for my poor English, I'm a little froggie.


Pierre

--
L'une des raisons pour lesquelles la vie est complexe
C'est qu'elle a une partie réelle et une partie imaginaire.




--
Souviens-toi qu'au moment de ta naissance tout le monde était dans la
joie et toi dans les pleurs.
Vis de manière qu'au moment de ta mort, tout le monde soit dans les
pleurs et toi dans la joie.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat Log4j

2006-11-22 Thread Pierre Goupil

Hi !

Yes, of course ! I'm using WTP's server view. And I would like to be able
to launch Tomcat from it again.

Pierre

--
L'une des raisons pour lesquelles la vie est complexe
C'est qu'elle a une partie réelle et une partie imaginaire.


RES: Tomcat Log4j Log Level Configuration

2005-10-14 Thread Paulo Alvim
Hi Jojo,

I'm with the same problem: I'd like to change the log level e also the
appender configurations without redeploy my war (my log4j.properties file
is bundled into the web-inf/classes)...

I have thought about a few - not very good - approaches (of course the best
one would be an out-of-box solution):

- I was wondering if I could change the log level by programming against
Log4j memory beans...have you already tried that? I have already done this
kind of configurations with Java code to initialize the appenders and
levels, but I'm not sure if there are performance or thread safe issues
related to modified them on fly...

- Try to put my log4j.properties out of the war (something like each war's
log4j file into subdirectories of Tomcat's log directory). This would also
require app code to reload log4j configuration - I don't know if it's
possible...

- Manage log4j configurations as JMX beans...I'm not using JMX in depth but
it seems that I'd be able to modify the configuration this way.

Did you already get any answer about this subject?

Thanks!

Paulo

-Mensagem original-
De: Jojo Paderes [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 8 de setembro de 2005 07:45
Para: Tomcat User List
Assunto: Tomcat Log4j Log Level Configuration


How do I configure Tomcat or Log4J to change the log level output
during runtime? Anybody already done this successfully with Tomcat
5.5.9?

--
My Blogs http://jojopaderes.blogspot.com
Google Talk http://www.google.com/talk (ID: jojo.paderes)

In preparing for battle I have always found that plans are useless,
but planning is indispensable. - Eisenhower

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RES: RES: Tomcat Log4j Log Level Configuration

2005-10-14 Thread Paulo Alvim
Thank you, Jess...

I'm now trying to use the (log4j) ConfigurationServlet in order to learn
more about these problems...the information bellow is very usefull!

Alvim.

-Mensagem original-
De: Jess Holle [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 14 de outubro de 2005 10:05
Para: Tomcat Users List
Cc: Tomcat Users List; [EMAIL PROTECTED]
Assunto: Re: RES: Tomcat Log4j Log Level Configuration


Paulo Alvim wrote:

Hi Jojo,

I'm with the same problem: I'd like to change the log level e also the
appender configurations without redeploy my war (my log4j.properties file
is bundled into the web-inf/classes)...


This is a major failing of the WAR format as I see it.  You have to
redeploy everything to change anything but the deployment descriptor.
That seems less than realistic for a large web application.

I have thought about a few - not very good - approaches (of course the best
one would be an out-of-box solution):

- I was wondering if I could change the log level by programming against
Log4j memory beans...have you already tried that? I have already done this
kind of configurations with Java code to initialize the appenders and
levels, but I'm not sure if there are performance or thread safe issues
related to modified them on fly...


Do you mean log4j management bean (MBeans)?  If so, there are issues
with these and use per-web-app logging repositories.

I wrote my own MBeans for log4j to get around this and many other issues
I encountered with the bundled MBeans.  [My MBeans allow me to create a
separate branch of MBeans for each log4j LoggerRepository, e.g. one per
web app and one for the default LoggerRepository as well if one
configures Tomcat itself to use log4j as well.]

- Try to put my log4j.properties out of the war (something like each war's
log4j file into subdirectories of Tomcat's log directory). This would also
require app code to reload log4j configuration - I don't know if it's
possible...


This is doable.  You could have JNDI environment entries in your
deployment descriptor (your Context XML) calling out the location of
your log4j properties (or XML) file.  You can then have a thread watch
this for changes and reapply the config file on the fly when changes are
noticed.  log4j has functionality for this, but it is problematic in
that you can't cleanly close down the threads on web app shutdown, etc,
so you're better off writing your own (or using log4j 1.3, which
supposedly fixes this but is in alpha...)

- Manage log4j configurations as JMX beans...I'm not using JMX in depth but
it seems that I'd be able to modify the configuration this way.


Oh, so you meant something else above.

--
Jess Holle

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]