SV: Log4J stops logging

2005-04-05 Thread Henrik Engert
I think we found the problem. 

We have bunch of threads running and sometimes we don't want to log things like 
passwords etc. so we set the loglevel to WARN when these calls to the database 
comes (We actually don't encrypt passwords which is strange, but it is not me 
who makes those decissions). Now, this implementation is not well planned 
because since we have many threads we end up in a situation where we only log 
WARN level for this database class.

I have now eliminated this problem.

Thanks
Henrik

-Ursprungligt meddelande-
Från: Bradley, Todd [mailto:[EMAIL PROTECTED] 
Skickat: den 4 april 2005 17:06
Till: Log4J Users List
Ämne: RE: Log4J stops logging

That is strange.  Have you already tried turning on log4j debug output to see 
if somebody's resetting or re-reading the configuration that you don't know 
about?


Todd. 

 -Original Message-
 From: Henrik Engert [mailto:[EMAIL PROTECTED]
 Sent: Monday, April 04, 2005 3:30 AM
 To: log4j-user@logging.apache.org
 Subject: Log4J stops logging
 
 Hi,
 
 We have a problem with our application that uses Log4j. All of a 
 sudden it stops logging INFO level and only keeps on logging DEBUG 
 level. If I restart the application it works fine for a while then it 
 stops.
 
 We are using Log4J version 1.2.8 and Java 1.4.
 
 We initialize Log4J with a property file like this:
 
 log4j.rootCategory=3DDEBUG, FILE
 
 log4j.appender.FILE=3Dorg.apache.log4j.RollingFileAppender
 log4j.appender.FILE.File=3D/bookit/prod/dataBI30/log/z3970.log
 log4j.appender.FILE.MaxFileSize=3D30MB
 log4j.appender.FILE.MaxBackupIndex=3D4
 log4j.appender.FILE.layout=3Dorg.apache.log4j.PatternLayout
 log4j.appender.FILE.layout.ConversionPattern=3D%d %-4r [%t] %-5p %c %x 
 - %m%n
 
 We are not resetting the log4J anywhere in the code or it's treshold.
 
 Any ideas?
 
 Regards,
 Henrik Engert
 ###
 
 This message has been scanned by F-Secure Anti-Virus for Microsoft 
 Exchange.
 For more information, connect to http://www.f-secure.com/
 
 -
 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]

###

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/

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



AW: Generate Protocols with Log4J

2005-04-05 Thread Weseloh, Markus
That might be a solution. But is it possible to configure dynamic
categories so that for each username I'll get a separate logfile (like
username.log)? Another question: when I implement this approach I get a
Logger for each user (and for each class that needs a Logger). When many
users access my server I have many Loggers that won't be used any longer
when the user disconnects from ther server. Is there a way to discard a
Logger? I don't want to have to reboot my server every few days because it
runs out of memory (since the JVM contains a lot of unused Loggers).
Perhaps writing a thread aware appender that splits the LoggingEvents by the
Logger name into different logs might be a solution?
Or is log4j not the right solution for the usecase described below?

-Ursprüngliche Nachricht-
Von: James Stauffer [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 4. April 2005 14:37
An: Log4J Users List
Betreff: Re: Generate Protocols with Log4J

You may find that creating a logger per user would work for you.
Logger logger = Logger.getLogger(username + . + getClass().getName());

On Apr 4, 2005 7:35 AM, Weseloh, Markus [EMAIL PROTECTED] wrote:
 Hallo,
 
 I'm writing a client-server application where the client sends a 
 request to the server and the server starts a complex process. This 
 process has to generate a protocol that can be stored in a database or 
 send to an email address. I would like to generate this protocol with 
 log4j but I don't exactly know how to do it. The protocol is client 
 request specific so there is not one or more logfiles for the whole 
 server, but one logfile for each client request. Of course multiple 
 clients can access the server at the same time. Is there a best practice
to implement this behaviour?
 
 Markus Weseloh
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

-
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]



simple question from newcomer

2005-04-05 Thread William Cai
Hi all,

 

Don't want to waste your time. My question is how to configure log4j, let it
log to my database. Do I need to do any custom development? If yes, could
you please give my some tips? Thank you!

 

-William



Can log levels be configured based on NDC?

2005-04-05 Thread Rob Oxspring
We have an application composed of some low level libraries and some 
higher level components all combined to create a single tool.  As we 
wrote ComponentA it was useful to have the lower level libraries logging 
lots of debug but now we have confidence in ComponentA we can switch the 
libraries to something higher than DEBUG.  Now we need to develop 
ComponentB and would like to have the libraries logging at DEBUG when 
called from COmponentB and INFO (or whatever) when called from 
ComponentA.  NDCs seemed the way to go but can I configure the levels 
based on the current NDC?

An added complication is that some of our libraries use multiple 
threads, is can NDC's be copied to other threads so that the logging is 
consistent? or are there other forms of context that are more appropriate?

Thanks in advance,
Rob
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Generate Protocols with Log4J

2005-04-05 Thread James Stauffer
It will be easy to setup a distince appender per username if the
number of usernames is low.  I don't think you can deallocate a logger
and I don't know if the memory usage will be significant so you may
want to do some testing if no one else answers this.

Another option:  Set the username in MDC and send the logs to the
Database (or something else that will allow you to filter by MDC
value).  Then you can run queries that only show you logs for specific
users.

On Apr 5, 2005 4:39 AM, Weseloh, Markus [EMAIL PROTECTED] wrote:
 That might be a solution. But is it possible to configure dynamic
 categories so that for each username I'll get a separate logfile (like
 username.log)? Another question: when I implement this approach I get a
 Logger for each user (and for each class that needs a Logger). When many
 users access my server I have many Loggers that won't be used any longer
 when the user disconnects from ther server. Is there a way to discard a
 Logger? I don't want to have to reboot my server every few days because it
 runs out of memory (since the JVM contains a lot of unused Loggers).
 Perhaps writing a thread aware appender that splits the LoggingEvents by the
 Logger name into different logs might be a solution?
 Or is log4j not the right solution for the usecase described below?
 
 -Ursprüngliche Nachricht-
 Von: James Stauffer [mailto:[EMAIL PROTECTED]
 Gesendet: Montag, 4. April 2005 14:37
 An: Log4J Users List
 Betreff: Re: Generate Protocols with Log4J
 
 You may find that creating a logger per user would work for you.
 Logger logger = Logger.getLogger(username + . + getClass().getName());
 
 On Apr 4, 2005 7:35 AM, Weseloh, Markus [EMAIL PROTECTED] wrote:
  Hallo,
 
  I'm writing a client-server application where the client sends a
  request to the server and the server starts a complex process. This
  process has to generate a protocol that can be stored in a database or
  send to an email address. I would like to generate this protocol with
  log4j but I don't exactly know how to do it. The protocol is client
  request specific so there is not one or more logfiles for the whole
  server, but one logfile for each client request. Of course multiple
  clients can access the server at the same time. Is there a best practice
 to implement this behaviour?
 
  Markus Weseloh
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 --
 James Stauffer
 Are you good? Take the test at http://www.livingwaters.com/good/
 
 -
 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]
 
 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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



Re: Can log levels be configured based on NDC?

2005-04-05 Thread James Stauffer
Just set the componentA logger to info and the componentB logger to debug.

XML example config:
  logger name=com.componentA
level value=info/
  /logger

  logger name=com.componentB
level value=debug/
  /logger

  root
appender-ref ref=appender/
  /root


On Apr 5, 2005 6:31 AM, Rob Oxspring [EMAIL PROTECTED] wrote:
 We have an application composed of some low level libraries and some
 higher level components all combined to create a single tool.  As we
 wrote ComponentA it was useful to have the lower level libraries logging
 lots of debug but now we have confidence in ComponentA we can switch the
 libraries to something higher than DEBUG.  Now we need to develop
 ComponentB and would like to have the libraries logging at DEBUG when
 called from COmponentB and INFO (or whatever) when called from
 ComponentA.  NDCs seemed the way to go but can I configure the levels
 based on the current NDC?
 
 An added complication is that some of our libraries use multiple
 threads, is can NDC's be copied to other threads so that the logging is
 consistent? or are there other forms of context that are more appropriate?
 
 Thanks in advance,
 
 Rob
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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



RE: simple question from newcomer

2005-04-05 Thread Bradley, Todd
I've never used it personally, but there is a JDBCAppender class for
sending log messages to a database.  Here is the reference page:

http://logging.apache.org/log4j/docs/api/org/apache/log4j/jdbc/JDBCAppen
der.html


Todd. 

 -Original Message-
 From: William Cai [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, April 05, 2005 3:46 AM
 To: log4j-user@logging.apache.org
 Subject: simple question from newcomer
 
 Hi all,
 
  
 
 Don't want to waste your time. My question is how to 
 configure log4j, let it log to my database. Do I need to do 
 any custom development? If yes, could you please give my some 
 tips? Thank you!
 
  
 
 -William
 
 

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



RE: How to disable log4j option using GUI?

2005-04-05 Thread Bradley, Todd
Maybe I don't understand your question, but wouldn't it just be
something like this?

mySMTPAppender.close();


Todd. 

 -Original Message-
 From: utpal [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, April 05, 2005 6:25 AM
 To: log4j-user@logging.apache.org
 Subject: How to disable log4j option using GUI?
 
 Hi All,
 I am displaying the mailing(smtp) option for log4j in GUI. I 
 have set the smtp appender in log4j.properties file. While 
 run time(i.e. using
 GUI) how I can disable the smtp appender? 
 What is the way to do this...?
 
 
 

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



Re: JDBCAppender replacement

2005-04-05 Thread James Stauffer
I don't know when it will be released.  Probably when it is ready. :-)

On Apr 5, 2005 11:26 AM, John Ferron [EMAIL PROTECTED] wrote:
 And when is 1.3 going to be a stable production release?
 
  [EMAIL PROTECTED] 4/5/2005 11:22:11 AM 
 1.3 has a replacement (DBAppender).
 
 On Apr 5, 2005 11:09 AM, John Ferron [EMAIL PROTECTED]
 wrote:
  I'm curious as to when the JDBCAppender class is slated to be
 replaced
  in the current implemenation of Log4j.  I saw that there is an
  implemention by  http://www.dankomannhaupt.de/projects/.  I was just
  curious as to what I should be using.  I would like to be using the
  log4j implemention but I saw in the API documentation that it might
 be
  replaced.  Please advise.
 
  John
 
 
 
 --
 James Stauffer
 Are you good? Take the test at http://www.livingwaters.com/good/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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



RE: JDBCAppender replacement

2005-04-05 Thread Lenin David Lozano Argel
I guess that the choice is to use another JDBCAppender implementation. The 
JDBCAppender that comes with log4j does not use PreparedStatement, and this is 
a poor practice with JDBC.

Lenin David Lozano Argel
Analista Arquitectura Informtica
Gerencia de Desarrollo
Suramericana S.A.
Email: [EMAIL PROTECTED]
Tel: (+574)4355596, Medellin - Colombia 




-Mensaje original-
De: James Stauffer [mailto:[EMAIL PROTECTED]
Enviado el: Martes, 05 de Abril de 2005 11:45 a.m.
Para: Log4J Users List
Asunto: Re: JDBCAppender replacement


I don't know when it will be released.  Probably when it is ready. :-)

On Apr 5, 2005 11:26 AM, John Ferron [EMAIL PROTECTED] wrote:
 And when is 1.3 going to be a stable production release?
 
  [EMAIL PROTECTED] 4/5/2005 11:22:11 AM 
 1.3 has a replacement (DBAppender).
 
 On Apr 5, 2005 11:09 AM, John Ferron [EMAIL PROTECTED]
 wrote:
  I'm curious as to when the JDBCAppender class is slated to be
 replaced
  in the current implemenation of Log4j.  I saw that there is an
  implemention by  http://www.dankomannhaupt.de/projects/.  I was just
  curious as to what I should be using.  I would like to be using the
  log4j implemention but I saw in the API documentation that it might
 be
  replaced.  Please advise.
 
  John
 
 
 
 --
 James Stauffer
 Are you good? Take the test at http://www.livingwaters.com/good/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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



La informacin adjunta es exclusiva para la persona a la cual se dirige este 
mensaje, la cual puede contener informacin confidencial y/o material 
privilegiado. Cualquier revisin, retransmisin, diseminacin o uso del 
mismo, as como cualquier accin que se tome respecto a la informacin 
contenida, por personas o entidades diferente al propsito original de las 
misma, es ilegal. Si usted recibe este mensaje por error, favor notifqueme y 
elimine ese material. 
Este mensaje y sus anexos han sido sometidos a programas antivirus, por lo cual 
consideramos se encuentra libre de virus o cualquier anomala que pueda 
afectar a terceros, sin embargo, el destinatario debe verificar con sus propias 
protecciones que ellos no estn afectados por virus u otros defectos, en cuyo 
caso, el remitente no asume responsabilidad alguna por el recibo, transmisin 
y uso de este material.

The information transmitted here within is sensitive information intended only 
for use of the individual or entity to which it is addresses. If the reader of 
this message is not the intended recipient, you are hereby notified that any 
review, retransmission, dissemination, distribution, copying or other use of, 
or taking of any action in reliance upon, this information is strictly 
prohibited. IF you have received this communication in error, please contact 
the sender and delete the material from your computer.
Viruses: The message and its attachments are considered to be free of any virus 
or other defect. Nevertheless, we advise the recipient to verify that the 
material is virus free. Suramericana is not responsible for any loss or damages 
arising out of the transmission, use or handling of this matrial.

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



Re: JDBCAppender replacement

2005-04-05 Thread James Stauffer
I started on a version that used prepared statements (you can have the
code if you wish) but I ran into issues trying to keep it generic
because Oracle doesn't have generated keys.

On Apr 5, 2005 11:47 AM, Lenin David Lozano Argel
[EMAIL PROTECTED] wrote:
 I guess that the choice is to use another JDBCAppender implementation. The 
 JDBCAppender that comes with log4j does not use PreparedStatement, and this 
 is a poor practice with JDBC.
 
 Lenin David Lozano Argel
 Analista Arquitectura Informática
 Gerencia de Desarrollo
 Suramericana S.A.
 Email: [EMAIL PROTECTED]
 Tel: (+574)4355596, Medellin - Colombia
 
 -Mensaje original-
 De: James Stauffer [mailto:[EMAIL PROTECTED]
 Enviado el: Martes, 05 de Abril de 2005 11:45 a.m.
 Para: Log4J Users List
 Asunto: Re: JDBCAppender replacement
 
 
 I don't know when it will be released.  Probably when it is ready. :-)
 
 On Apr 5, 2005 11:26 AM, John Ferron [EMAIL PROTECTED] wrote:
  And when is 1.3 going to be a stable production release?
 
   [EMAIL PROTECTED] 4/5/2005 11:22:11 AM 
  1.3 has a replacement (DBAppender).
 
  On Apr 5, 2005 11:09 AM, John Ferron [EMAIL PROTECTED]
  wrote:
   I'm curious as to when the JDBCAppender class is slated to be
  replaced
   in the current implemenation of Log4j.  I saw that there is an
   implemention by  http://www.dankomannhaupt.de/projects/.  I was just
   curious as to what I should be using.  I would like to be using the
   log4j implemention but I saw in the API documentation that it might
  be
   replaced.  Please advise.
  
   John
  
  
 
  --
  James Stauffer
  Are you good? Take the test at http://www.livingwaters.com/good/
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 --
 James Stauffer
 Are you good? Take the test at http://www.livingwaters.com/good/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 La información adjunta es exclusiva para la persona a la cual se dirige este 
 mensaje, la cual puede contener información confidencial y/o material 
 privilegiado. Cualquier revisión, retransmisión, diseminación o uso del 
 mismo, así como cualquier acción que se tome respecto a la información 
 contenida, por personas o entidades diferente al propósito original de las 
 misma, es ilegal. Si usted recibe este mensaje por error, favor notifíqueme y 
 elimine ese material.
 Este mensaje y sus anexos han sido sometidos a programas antivirus, por lo 
 cual consideramos se encuentra libre de virus o cualquier anomalía que pueda 
 afectar a terceros, sin embargo, el destinatario debe verificar con sus 
 propias protecciones que ellos no están afectados por virus u otros defectos, 
 en cuyo caso, el remitente no asume responsabilidad alguna por el recibo, 
 transmisión y uso de este material.
 
 The information transmitted here within is sensitive information intended 
 only for use of the individual or entity to which it is addresses. If the 
 reader of this message is not the intended recipient, you are hereby notified 
 that any review, retransmission, dissemination, distribution, copying or 
 other use of, or taking of any action in reliance upon, this information is 
 strictly prohibited. IF you have received this communication in error, please 
 contact the sender and delete the material from your computer.
 Viruses: The message and its attachments are considered to be free of any 
 virus or other defect. Nevertheless, we advise the recipient to verify that 
 the material is virus free. Suramericana is not responsible for any loss or 
 damages arising out of the transmission, use or handling of this matrial.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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



Re: log4j trace enabled version

2005-04-05 Thread Peter DeGregorio
Here is a link to a version of log4j called trace4j which provides a 
built-in trace level to log4j 
http://home.comcast.net/~pdegregorio/index.html . A detailed how-to will be 
provided shortly for anyone inclined to do this themselves and has about an 
hour to work on it. -- Peter
- Original Message - 
From: Endre Stølsvik [EMAIL PROTECTED]
Newsgroups: gmane.comp.jakarta.log4j.user
Sent: Monday, April 04, 2005 11:10 AM
Subject: RE: log4j trace enabled version


On Sun, 3 Apr 2005, Andy McBride wrote:
| You don't need to look at CVS to find what you are looking for.
|
| A search of the log4j-dev mailing list would have revealed many posts 
over
| the past year which answered your question.  Perhaps you should look 
there
| before making remarks regarding what the log4j committers have and have 
not
| decided to do.
|
| A vote was taken on adding the trace level and the functionality you 
desire
| has already been added to the forthcoming log4j 1.3 release.

Yes it was decided to add it, but not in which version.
Ceki (and possibly others) totally refused to just add those majorly nice
but _very simple_ changes to the 1.2.8 and 1.2.9 release. And now we're
waiting for lots of other stuff that's for my part rather uninteresting.
The 1.3 version does just not seem to happen.
1.3 comes when it's ready. And with it trace. Yes, okay. When? I want
trace now, from a proper release.
Regards,
Endre. 

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


Re: log4j trace enabled version

2005-04-05 Thread Jacob Kjome
Very proactive.  Nicely done!

Jake

Quoting Peter DeGregorio [EMAIL PROTECTED]:

 Here is a link to a version of log4j called trace4j which provides a
 built-in trace level to log4j
 http://home.comcast.net/~pdegregorio/index.html . A detailed how-to will be
 provided shortly for anyone inclined to do this themselves and has about an
 hour to work on it. -- Peter
 - Original Message -
 From: Endre Stølsvik [EMAIL PROTECTED]
 Newsgroups: gmane.comp.jakarta.log4j.user
 Sent: Monday, April 04, 2005 11:10 AM
 Subject: RE: log4j trace enabled version


  On Sun, 3 Apr 2005, Andy McBride wrote:
 
  | You don't need to look at CVS to find what you are looking for.
  |
  | A search of the log4j-dev mailing list would have revealed many posts
  over
  | the past year which answered your question.  Perhaps you should look
  there
  | before making remarks regarding what the log4j committers have and have
  not
  | decided to do.
  |
  | A vote was taken on adding the trace level and the functionality you
  desire
  | has already been added to the forthcoming log4j 1.3 release.
 
  Yes it was decided to add it, but not in which version.
 
  Ceki (and possibly others) totally refused to just add those majorly nice
  but _very simple_ changes to the 1.2.8 and 1.2.9 release. And now we're
  waiting for lots of other stuff that's for my part rather uninteresting.
  The 1.3 version does just not seem to happen.
 
  1.3 comes when it's ready. And with it trace. Yes, okay. When? I want
  trace now, from a proper release.
 
  Regards,
  Endre.


 -
 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]



RE: How to disable log4j option using GUI?

2005-04-05 Thread utpal
Basically, I am using more than one appender. SMTP appender is only for
critical messages. So in JSP or HTML (GUI) I am providing option that
whether user is required these critical messages by mail or not. So if
he selected mail option then he will receive mail otherwise not. But I
am using log4j.properties file to set this option. So how this option I
will change through program? or any other way to do this...?
In a program I written as
static Logger logger = Logger.getLogger(TestLog4J.class.getName());

and directly using logger object as
logger.log(XLevel.TRACE,DB connection not done.);

The log4j.properties file is as

log4j.rootCategory=info,RB1,EMAIL

#
#File Appender
#

log4j.appender.RB1=org.apache.log4j.FileAppender
log4j.appender.RB1.File=/tmp/log4j.log
log4j.appender.RB1.MaxFileSize=10MB
log4j.appender.RB1.MaxBackupIndex=15
log4j.appender.RB1.layout=org.apache.log4j.PatternLayout
log4j.appender.RB1.layout.ConversionPattern=[%d] [%c] [%-5p] - %m%n


# SMTP Appender
###


#log4j.rootCategory=TRACE#log.XLevel,EMAIL
log4j.appender.EMAIL=org.apache.log4j.net.SMTPAppender
log4j.appender.EMAIL.Threshold=TRACE#log.XLevel
[EMAIL PROTECTED]
[EMAIL PROTECTED]
log4j.appender.EMAIL.Subject=ALERT MESSAGE
log4j.appender.EMAIL.SMTPHost=dns.extenprise.net
log4j.appender.EMAIL.BufferSize=1000
log4j.appender.EMAIL.layout=org.apache.log4j.PatternLayout
log4j.appender.EMAIL.layout.ConversionPattern=%d %-5p %m%n


On Tue, 2005-04-05 at 20:13, Bradley, Todd wrote:

 Maybe I don't understand your question, but wouldn't it just be
 something like this?
 
 mySMTPAppender.close();
 
 
 Todd. 
 
  -Original Message-
  From: utpal [mailto:[EMAIL PROTECTED] 
  Sent: Tuesday, April 05, 2005 6:25 AM
  To: log4j-user@logging.apache.org
  Subject: How to disable log4j option using GUI?
  
  Hi All,
  I am displaying the mailing(smtp) option for log4j in GUI. I 
  have set the smtp appender in log4j.properties file. While 
  run time(i.e. using
  GUI) how I can disable the smtp appender? 
  What is the way to do this...?
  
  
  
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


RE: How to disable log4j option using GUI?

2005-04-05 Thread Jacob Kjome
You might want to look into some of the Log4j config web interfaces out 
there.  Whether you configured Log4j initially via properties or not, Log4j 
exposes its API to you.  So, you can programmatically modify settings.  See 
the third party utilities listed on Log4j download page...
http://logging.apache.org/log4j/docs/download.html

A couple that pop out there are Log4web and Logweb, though I am not 
endorsing either.  Just pointing them out as possible options.  There is 
also a basic configuration servlet in the log4j-sandbox you might try.

Jake
At 09:33 AM 4/6/2005 +0530, you wrote:
Basically, I am using more than one appender. SMTP appender is only for
critical messages. So in JSP or HTML (GUI) I am providing option that
whether user is required these critical messages by mail or not. So if
he selected mail option then he will receive mail otherwise not. But I
am using log4j.properties file to set this option. So how this option I
will change through program? or any other way to do this...?
In a program I written as
static Logger logger = Logger.getLogger(TestLog4J.class.getName());

and directly using logger object as
logger.log(XLevel.TRACE,DB connection not done.);

The log4j.properties file is as

log4j.rootCategory=info,RB1,EMAIL

#
#File Appender
#

log4j.appender.RB1=org.apache.log4j.FileAppender
log4j.appender.RB1.File=/tmp/log4j.log
log4j.appender.RB1.MaxFileSize=10MB
log4j.appender.RB1.MaxBackupIndex=15
log4j.appender.RB1.layout=org.apache.log4j.PatternLayout
log4j.appender.RB1.layout.ConversionPattern=[%d] [%c] [%-5p] - %m%n


# SMTP Appender
###

 

#log4j.rootCategory=TRACE#log.XLevel,EMAIL
log4j.appender.EMAIL=org.apache.log4j.net.SMTPAppender
log4j.appender.EMAIL.Threshold=TRACE#log.XLevel
[EMAIL PROTECTED]
[EMAIL PROTECTED]
log4j.appender.EMAIL.Subject=ALERT MESSAGE
log4j.appender.EMAIL.SMTPHost=dns.extenprise.net
log4j.appender.EMAIL.BufferSize=1000
log4j.appender.EMAIL.layout=org.apache.log4j.PatternLayout
log4j.appender.EMAIL.layout.ConversionPattern=%d %-5p %m%n


On Tue, 2005-04-05 at 20:13, Bradley, Todd wrote:

 Maybe I don't understand your question, but wouldn't it just be
 something like this?

 mySMTPAppender.close();


 Todd.

  -Original Message-
  From: utpal [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, April 05, 2005 6:25 AM
  To: log4j-user@logging.apache.org
  Subject: How to disable log4j option using GUI?
 
  Hi All,
  I am displaying the mailing(smtp) option for log4j in GUI. I
  have set the smtp appender in log4j.properties file. While
  run time(i.e. using
  GUI) how I can disable the smtp appender?
  What is the way to do this...?
 
 
 

 -
 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]