Re: Writing logs to several files

2007-08-13 Thread James Stauffer
See the recent thread with a subject of level based logging into
seperate files

On 8/11/07, Chamal De Silva [EMAIL PROTECTED] wrote:
 Hi,

 I am using RollingFileAppender.
 This is my log4j properties file.

 log4j.rootLogger=debug, R
 log4j.appender.R=org.apache.log4j.RollingFileAppender
 log4j.appender.R.File=syslog.log
 log4j.appender.R.MaxFileSize=100KB
 log4j.appender.R.MaxBackupIndex=5
 log4j.appender.R.layout=org.apache.log4j.PatternLayout
 log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

 But I want to write debug messages to a file called sysdebug.log, info
 messages to sysinfo.log and errors to syserror.log.  Please tell me how to
 do this.

 Thanking You,
 Chamal.



-- 
James A. N. Staufferhttp://www.geocities.com/stauffer_james/
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: Not able to DELETE Log Files

2007-08-13 Thread James Stauffer
The file probably can't be deleted because log4j has it open so that
it can write to it.

On 8/13/07, rajashekhar v [EMAIL PROTECTED] wrote:
 Hi All,

 I'm implementing Logger for Distributed System using Log4j. I have 4
 different servers and each server is having the local Logger. Apart from the
 local logger there will be an centralized logger in one server.
 Usually the messages are logged to the centralized logger only. When central
 server is down the messages are logged to the local server.
 When the Centralized server is up the locally logged files(messages) need to
 be logged to the Centralized server and local log files need to be
 deleted. When
 i try to delete the log files programmtically when the server is running its
 giving exception like access denied.
 I'm using XMLLayout Pattern and Tomcat as Application Server.

 Can any one help me in this case,

 regards,
 Rajashekhar V



-- 
James A. N. Staufferhttp://www.geocities.com/stauffer_james/
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: Changing log filepath and file name at runtime???

2007-08-03 Thread James Stauffer
You many need to use repository selectors so that each instance has
its own configureation.  Then each instance can have its own config
file.

On 8/3/07, sateesh [EMAIL PROTECTED] wrote:

 Hi James,

  We are running more than one sinatnce of our Service in a separate thread
 and we would like to have separate log file for each of them which we will
 specify while initializing it

  How do we specify it??

  We are using SLF4J and Log4J

  Could u pls let me know..

 Thanks
 Kumar


 James Stauffer wrote:
 
  Can you give more details about how and why you want to change it?  Do
  you want to set it only once per run (then use system properties) or
  do you want to change it multiple times per run (you may have to write
  your own appender).
 
  On 5/23/06, Kailash KN [EMAIL PROTECTED] wrote:
  Hi all,
 
  I would want to change the log filepath and log filename at runtime,
  how do i go about doing it???
 
 
  --
  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]
 
 
 

 --
 View this message in context: 
 http://www.nabble.com/Changing-log-filepath-and-file-name-at-runtimetf1667116.html#a11989397
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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




-- 
James Staufferhttp://www.geocities.com/stauffer_james/
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: Looking for high speed binary appender?

2007-08-01 Thread James Stauffer
What is your destination?  Files, database, JMS queue?  Do you have
any idea how much logging you will be doing?

On 8/1/07, Paul Duffy [EMAIL PROTECTED] wrote:
 Folks,

 My team is looking at log4j as a next generation logging option, but we
 have a specific customer need to do high volume logging which a text
 based system may not support.  Is anyone aware of a high speed binary
 logging capability that builds upon the log4j infrastructure (or otherwise?

 Cheers

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




-- 
James Staufferhttp://www.geocities.com/stauffer_james/
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: How to filter on logger name.

2007-08-01 Thread James Stauffer
Sending logs from only certain loggers to an appender is one of the
most common ways to use log4j.

On 8/1/07, Walter Holladay [EMAIL PROTECTED] wrote:
 Hi,

 I work on a large project that has lots of logging information being written
 to the log file. I want to narrow what logging data I see to only those
 messages logged by my team mates. The way I would like to do this is by
 having a filter that will only pass through messages logged from a given
 logger, or loggers. All of the loggers at my company are created using the
 class  that is doing the logging. For example private Logger logger =
 Logger.getLogger(getClass()). Therefore, I would like to be able to specify
 the class or the package that the logger belongs to, and only have those
 messages go to my log file.

 I would think this is a fairly common thing to do. However, I cannot find a
 filter that does this. Is there some way to accomplish this, short of
 writing my own filter?

 Thanks,
 Walter



-- 
James Staufferhttp://www.geocities.com/stauffer_james/
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: multiple JVMs writing to the same file

2007-07-31 Thread James Stauffer
You can have each JVM send the events to a single separate JVM with
SocketAppenders.  That single separate JVM would receive events from
all of the other JVMs and write them to a file.

On 7/31/07, Thomas michelbach [EMAIL PROTECTED] wrote:
 Hello,

 I'm using log4j in an environment with multiple jvms. I know that the best
 option for a central logging output, would be a database, but in this
 environment I don't have one. Now I use a different file for each jvm, but I
 need to consolidate them in one file.

 The best case would be to have the same appender in each JVM and they would
 have a buffer to protect the file and control the I/O. Is there any sample
 how to do this in log4j? Is it supported?

 Bye,
 Thomas



-- 
James Staufferhttp://www.geocities.com/stauffer_james/
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: level based logging into seperate files

2007-07-31 Thread James Stauffer
I have created one appender per level but each appender gets logs of
the given level and above.  Do you want to see an example of that?

On 7/31/07, Sarvananda [EMAIL PROTECTED] wrote:

 Thank you so much for your reply James.


 James Stauffer wrote:
 
  Are you using an un-modified log4j.jar? Open your log4j.jar and verify
  that org.apache.log4j.PatternLayout exists in it.
 

 Yes it does. I am using version 1.2.14.
 Logging as such works fine (makes me believe that the PatternLayout is
 workin from the properties file)
 if I use a simple properties file and append all levels into one single
 file. Of course,thats not what I want. Since filters are the only way I can
 append into different files, and filters are possible only with an xml file.
 I am using the above, and having problems
 Have you or has anyone tried to do this (seperate levels of logs into
 seperate log files)? If yes please let me know the approach/code for this.

 --
 View this message in context: 
 http://www.nabble.com/level-based-logging-into-seperate-files-tf4150902.html#a11918863
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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




-- 
James Staufferhttp://www.geocities.com/stauffer_james/
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: level based logging into seperate files

2007-07-31 Thread James Stauffer
Here are appenders for DEBUG, INFO, WARN, and ERROR:

  appender name=DebugApp class=org.apache.log4j.DailyRollingFileAppender
param name=File value=${catalina.base}/logs/Debug.txt /
param name=DatePattern value='.'-MM-dd-HH /
layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern value=%p %d{mm:ss.SSS}%c
  %m%n  /
/layout
  /appender

  appender name=OutputApp class=org.apache.log4j.DailyRollingFileAppender
param name=Threshold value=info/
param name=File value=${catalina.base}/logs/Output.txt /
param name=DatePattern value='.'-MM-dd-HH /
layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern value=%p %d{mm:ss.SSS}%c
  %m%n  /
/layout
  /appender

  appender name=WarnApp class=org.apache.log4j.DailyRollingFileAppender
param name=Threshold value=warn/
param name=File value=${catalina.base}/logs/Warn.txt /
param name=DatePattern value='.'-MM-dd-HH /
layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern value=%p %d{mm:ss.SSS} %c on
%t: %m%n  /
/layout
  /appender

  appender name=ErrorApp class=sps.log.log4j.DateFormatFileAppender
param name=Threshold value=error/
param name=File
value='${catalina.base}/logs/'MMM-dd-EEE'/'HH-mm-ss-S'.log' /
param name=Separate value=true /
layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern
value=%p %d{mm:s.SSS}%n   Location   : %C %M%n   Thread :
%t%n   Category   : %c%n   Run: %X{run}%n   entry  :
%X{entry}%n   entryParams: %X{entryParams}%n   Client :
%X{client}%n   SNAL # : %X{SNAL_Log}%n   Username   :
%X{username}%n   Occured At : %X{occuredAt}%n   docId  :
%X{docId}%n   senderId   : %X{senderId}%n   receiverId :
%X{receiverId}%n   formId : %X{formId}%n   evisionDocId:
%X{evisionDocId}%n   engineKey  : %X{engineKey}%n   appKey1:
%X{appKey1}%n   Query  : %X{SQL-Query} %X{SQL-Values}%n   Nested
Context: %x%n%m%n***%n
/
/layout
  /appender

On 7/31/07, Sarvananda [EMAIL PROTECTED] wrote:



 James Stauffer wrote:
 
  I have created one appender per level but each appender gets logs of
  the given level and above.  Do you want to see an example of that?
 

 Yes pleae. Id be grateful for that.

 thanks

 --
 View this message in context: 
 http://www.nabble.com/level-based-logging-into-seperate-files-tf4150902.html#a11929271
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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




-- 
James Staufferhttp://www.geocities.com/stauffer_james/
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: level based logging into seperate files

2007-07-30 Thread James Stauffer
Are you using an un-modified log4j.jar? Open your log4j.jar and verify
that org.apache.log4j.PatternLayout exists in it.

On 7/30/07, Sarvananda [EMAIL PROTECTED] wrote:

 Since after a lot of readin, I figrured that filters can only be used in an
 XML filem I made an XMl file and a java class to test it. Alas, I am still
 getting errors :
 -- java --
 log4j:ERROR Could not create the Layout. Reported error follows.
 java.lang.ClassNotFoundException: org.apache.log4j.PatternLayout
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:164)
 at org.apache.log4j.helpers.Loader.loadClass(Loader.java:178)
 at
 org.apache.log4j.xml.DOMConfigurator.parseLayout(DOMConfigurator.java:455)
 at


-- 
James Staufferhttp://www.geocities.com/stauffer_james/
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: level based logging into seperate files

2007-07-26 Thread James Stauffer
Just create one appender per level and use a LevelFilter to get only
the correct level.  You may find that doing something slightly
different is more useful.  Have each appender have a certain level and
above so that DebugAppender has all messages, InfoAppender has
everything but DEBUG, etc.  I find that when I look through the DEBUG
logs I want to see all higher logs also.

On 7/26/07, Sarvananda [EMAIL PROTECTED] wrote:

 Dear all,

 I have a simple question and I have no solution. Did a lot of google and
 tried too many things. I am not going where I want to. My only requirement
 is : I need to be able to use a logger object and append different levels of
 logs into different files (ofcourse the logs should have the classname, time
 and the error)(like Warn messages go to warn_log error messages go to
 error_log) .  I am completely stuck with this simple thing... may be I just
 have too much on my mind.

 I would appreciate if someone could help me with this.

 Thanks in advance for your time

 Regards,


 --
 View this message in context: 
 http://www.nabble.com/level-based-logging-into-seperate-files-tf4150902.html#a11808248
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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




-- 
James Staufferhttp://www.geocities.com/stauffer_james/
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: initializing log4j per thread

2007-07-26 Thread James Stauffer
You may have to write your own appender for this.  It would be simliar
to people who want one log per user so you might find good suggestions
in the archive if you search for something like file per user.

On 7/26/07, zaphod_beeblebrox [EMAIL PROTECTED] wrote:

 Hi All

   I have a web application ( deployed on weblogic )  which runs jobs in a
 quartz scheduler using a simple thread pool,

   The problem is that each time a worker thread starts a scheduled job i
 need to direct logging to a different file

Each job is a instance of a different class





 --
 View this message in context: 
 http://www.nabble.com/initializing-log4j-per-thread-tf4152297.html#a11812604
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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




-- 
James Staufferhttp://www.geocities.com/stauffer_james/
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 Manual, where?

2007-07-25 Thread James Stauffer

The answer is simple.  There is no free, comprehensive manual because
no one has written one.

OTOH log4j isn't that complicated so using the free, short manual can
usually get you started.

On 7/25/07, Hans Schwaebli [EMAIL PROTECTED] wrote:

Why is there no good log4j manual?

  I can't find it anywhere. If I missed it, please tell me where it is.

  The turk who programmed log4j has written a manual, but it is not free. I am 
looking for a free manual.

  If you don't know what I mean, I mean something like the Ant manual, where 
everything is documented.

  Thanks.


-
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us.



--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Recipients of email appender depending on log message, possible?

2007-07-16 Thread James Stauffer

Look at the *Filter classes in
http://logging.apache.org/log4j/docs/api/org/apache/log4j/varia/package-summary.html
and then you can search on those class names.

On 7/15/07, David Lloyd [EMAIL PROTECTED] wrote:


Well,

http://www.google.com.au/search?q=log4j-user+message+filtering

...lead me to this:

http://permalink.gmane.org/gmane.comp.jakarta.log4j.user/12341

...at time of writing that's the second link.

Route all the events to both file appenders, and specify a different
ExpressionFilter on each appender.

I looked up Expression Filters log4j and they appear to be Log4J 1.3
specific...

DSL

 I believe I have seen examples on the mailing list so there should be
 examples in the archive.

 On 7/11/07, Hans Schwaebli [EMAIL PROTECTED] wrote:
 Come on... You know what I mean. I didn't find any good manual or
 tutorial freely available for log4j. And I searched for half an hour.
 Excuse me if I then dare to ask here. So if anyone can tell me, I
 would be glad.


 James Stauffer [EMAIL PROTECTED] wrote: Did you search the
 mailing list archives, wiki, and javadocs?

 On 7/11/07, Hans Schwaebli  wrote:
  It seems this is a solution. But I couldn't find a site where using
 log4j filters is described. Any idea?
 



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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Recipients of email appender depending on log message, possible?

2007-07-11 Thread James Stauffer

You might be able to achieve that with an appender filter.

On 7/11/07, Hans Schwaebli [EMAIL PROTECTED] wrote:

I want to send a email depending on the log text. I add the terminal ID to the 
log text, which is the one of the user who caused the exception, which is 
logged at error level. Depending on that ID (or a regular expression) I want to 
send the email to certain recipients.

  Does this work with log4j configuration out of the box? What is the solution 
for this?


-
Yahoo! oneSearch: Finally,  mobile search that gives answers, not web links.



--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Recipients of email appender depending on log message, possible?

2007-07-11 Thread James Stauffer

Did you search the mailing list archives, wiki, and javadocs?

On 7/11/07, Hans Schwaebli [EMAIL PROTECTED] wrote:

It seems this is a solution. But I couldn't find a site where using log4j 
filters is described. Any idea?


James Stauffer [EMAIL PROTECTED] wrote:
  You might be able to achieve that with an appender filter.

On 7/11/07, Hans Schwaebli wrote:
 I want to send a email depending on the log text. I add the terminal ID to 
the log text, which is the one of the user who caused the exception, which is 
logged at error level. Depending on that ID (or a regular expression) I want to 
send the email to certain recipients.

 Does this work with log4j configuration out of the box? What is the solution 
for this?


 -
 Yahoo! oneSearch: Finally, mobile search that gives answers, not web links.


--
James Stauffer http://www.geocities.com/stauffer_james/
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]




-
Got a little couch potato?
Check out fun summer activities for kids.



--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Recipients of email appender depending on log message, possible?

2007-07-11 Thread James Stauffer

I believe I have seen examples on the mailing list so there should be
examples in the archive.

On 7/11/07, Hans Schwaebli [EMAIL PROTECTED] wrote:

Come on... You know what I mean. I didn't find any good manual or tutorial 
freely available for log4j. And I searched for half an hour. Excuse me if I 
then dare to ask here. So if anyone can tell me, I would be glad.


James Stauffer [EMAIL PROTECTED] wrote: Did you search the mailing list 
archives, wiki, and javadocs?

On 7/11/07, Hans Schwaebli  wrote:
 It seems this is a solution. But I couldn't find a site where using log4j 
filters is described. Any idea?



--
James Staufferhttp://www.geocities.com/stauffer_james/
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: How to always log the host name?

2007-07-05 Thread James Stauffer

I had added the hostname as an MDC value at application startup to achieve that.

On 7/4/07, Hans Schwaebli [EMAIL PROTECTED] wrote:

How can I configure the log4j logging to add the hostname information into the 
logging output?

  Most naturally would be to find a conversion character for the hostname in 
the PatternLayout. But there is none.


-
Building a website is a piece of cake.
Yahoo! Small Business gives you all the tools to get online.



--
James Staufferhttp://www.geocities.com/stauffer_james/
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 as good as jack daniels??

2007-07-05 Thread James Stauffer

On 7/5/07, Mike Wilkinson [EMAIL PROTECTED] wrote:

Do all of the threads also write to the same file?


Yes.


Would there be any issue with multiple threads writing to the same file?


No.



 On 7/5/07, James Stauffer [EMAIL PROTECTED] wrote:
   and if you go the latter route,  do you have to synchronize the
logger's
  methods  - i would think you would have to

 I have used the all threads share one instance method without
 synchronizing access and it works great.  I believe log4j is writen to
 to handle all threads sharing one logger instance but I don't know if
 anyone has compared the performance.

 On 7/4/07, Mike Wilkinson [EMAIL PROTECTED] wrote:
  Hey Jim,
 
  Sorry I am drinkin and researchin so I am a liitle type happy
 
  I sent the same message to Edwin too,
 
   I am mike nice to meet you.
 
   hey i was wondering did you ever figure out which was better for using
  log4j in multi-threaded apps - one instance per thread vs. all threads
share
  one instance??
 
   and if you go the latter route,  do you have to synchronize the
logger's
  methods  - i would think you would have to
 
   any advice you can provide is greatly appreciated.
 
   Cheers,
 
   Mike Wilkinson
 
 
   p.s. fresh, cold wheat beer is very good with just a drop of good
orange
  juice in the bottom of the mug - mmm
 



--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Urgent Please--How to create different log files with different property files in same webapplication

2007-06-26 Thread James Stauffer

Since JSPs are compiled into servlets you should be able to do almost
anything in a JSP that you can do in a servlet.

On 6/26/07, sivamma [EMAIL PROTECTED] wrote:


However i am not using Servlets to initialize the log4j.
So Even to implement repository selector i am not using servlets.
Our customers requested us to not use servlets.Since we made everything
using Java and jsps.


--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Urgent Please--How to create different log files with different property files in same webapplication

2007-06-25 Thread James Stauffer

If xyz and abc are different web apps then moving log4j.jar and
log4j.xml from common to WEB-INF/lib should keep the logs separate.
If they are in the same web app then they probably have different
logger name roots so you can configure each to use a different
appender. (i.e com.abc uses one appender and com.xyz uses another
appender).

On 6/25/07, sivamma [EMAIL PROTECTED] wrote:


Hi,
  I have a requirement to create different log files in same application.Our
application will be used in a different web application.Even the other
application is using log4j.We have our own log4j configuration
property(WEB-INF/config.properties) file and separate log file in a
particular directory(WEB-INF/logs/xxx.log).

At present the problem is we are getting logs from other application to our
log file.
Our application(Giving  as jar files) is under other application.

For example our application is abc and others is xyz.

The directory structure is webapps/xyz/WEB-INF where it contains xyz's
log4j property file as well abc's log4j property file.abc's logs are
supposed to go webappas/xyz/WEB-INF/logs/abc.log and xyz's logs are
supposed to go different file(Which we dont know , exactly where it goes).
But at present xyz's logs are coming into abc's logs means , they are coming
into webapps/xyz/WEB-INF/logs/abc.log

Can you please tell me how can get logs only from my applicaiton(may not be
from my application..only from  my classes).

Its little urgent.
Thanks in advacne.
Regards,
Sivamma.
--
View this message in context: 
http://www.nabble.com/Urgent-Please--How-to-create-different-log-files-with-different-property-files-in-same-webapplication-tf3974952.html#a11283346
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: JUnit testing of output logged with log4j?

2007-06-25 Thread James Stauffer

One option would be to using a test log4j.xml file that has appender
filters that filter out expected error messages.  Maintaining that
might not be easy.

On 6/23/07, Bob Jacobsen [EMAIL PROTECTED] wrote:

I've got a bunch of code that uses log4j for logging, and a large
number of unit tests done with JUnit.

As is the nature of these tests, they test a lot of error conditions,
which results in lots of error and warning messages logged when
running the tests.  Up until now, we just ignored those:  If the
tests passed, nobody looked at the test output. If the tests failed,
then we started looking at the output for abnormal errors, which is
really a mess.

My co-developers and I would like to clean this whole situation up,
so that the tests run with no error or warning messages appearing in
the output log.  But we still want to _test_ the conditions that are
errors, and in the code as it exists will throw those messages.
And we still want to see if _other_ error and warning messages start
appearing when the tests are run.

Anybody know how to Do This Right?

So far, we've got a couple suggestions:

1) Go through and find all the places where the error messages are
logged, and make then log through a service routine which can be
over-ridden.  E.g.

  class Mine {
void doSomething() {
  ...
  if (bad) log.error(Oops);
 }
}

becomes

  class Mine {
void doSomething() {
  ...
  if (bad) report(Oops);
 }
void report(String msg) {
log.error(msg);
}
}

Then we can test it with

  new Mine(){
  void report(String msg) {
  if (!msg.equals(Oops))
// assert error
  }
   }

The subclassing lets us intercept the error _before_ it gets to
log4j, and test it manually.  But there's a _huge_ amount of this. It
seems a complete pain to do all this, and since we'd be putting in a
cover layer in front of log4j in each class, it seems far from a
best practice.

2) Instead of suppressing the good messages, learn to ignore them.

To do this, we'd just take a log from normal tests, and built into
our testing that we diff the current output with the normal log.
New or missing lines would be visible to the author; the same old
stuff would pass through the diff.

Of course, this is a maintenance nightmare. As code changes, we'd
have to keep the master error log synchronized, but it would be
easy for somebody to pass a Really Bad Thing as a new normal error.

This is currently the most popular choice, mostly because it doesn't
need to rework the existing code, but I really don't like it.

3) Do something via log4j itself.

I'm not even sure what I'm asking here, but can we somehow
programmatically access a stream of log4j log entries, and manipulate
it?

What I'm imagining is a test like this:

a) Push all existing stuff in log to whatever outputs are configured.

b) Temporarily stop output of log entries

c) run test

d) Check through log entries accumulated since (b), which come from
the test, and remove the ones that are expected (optionally, tell
JUnit to fail if something is missing)

e) Allow all other log entries to continue to their configured outputs


If there was some way to do this, we could have unexpected messages
still go to the usual places, as configured, but remove expected
messages from the log stream.

Is there a way to do this?

Or is there a better solution to the whole need?

Thanks in advance.

Bob

--
Bob Jacobsen, UC Berkeley
[EMAIL PROTECTED] +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Urgent Please--How to create different log files with different property files in same webapplication

2007-06-25 Thread James Stauffer

Can you better explain the relationship between abc and xyz?  It
sounds like xyz uses abc as a library and that abc also runs by
itself.

Repository selectors might help.

On 6/25/07, sivamma [EMAIL PROTECTED] wrote:


We dont know exactly how log4j is handled at XYZ(They are our customers).But
in abc , we are referring a config file through our code.

Please find our java code.
==
package com.CK;


import java.io.File;

import org.apache.log4j.Logger;
import org.apache.log4j.Level;
import org.apache.log4j.PropertyConfigurator;

public class Log4jSetup
{
public static String rPath = null;
public Log4jSetup(String realPath)
{
rPath = realPath;
}
public Log4jSetup()
{
String filePath =
rPath+File.separator+WEB-INF+File.separator+config.properties;
String logfilePath =
rPath+File.separator+WEB-INF+File.separator+logs+File.separator;
if( !(new File(filePath)).isFile())
{
System.err.println([CK]ERROR:Log4jSetUp::Cannot read 
the Log4J
configuration file.  );
}
System.setProperty(ck.base,logfilePath);

PropertyConfigurator.configure(filePath);
Logger log = Logger.getLogger(Log4jSetup.class);
}
}
=


Thanks  Regards,
Sivamma.

James Stauffer wrote:

 How exactly is log4j configured from abc and xyz?  Directly through
 code? Code referencing a config file?  log4j automatically finding a
 config file?

 On 6/25/07, sivamma [EMAIL PROTECTED] wrote:

 Hi, Thank you for immediate reply.
 The problem is little different here.XYZ and abc are in same
 application.XYZ
 is using abc's jar files and jsps.
 Our application(abc) have our own log4j configuration property file at
 WEB-INF folder of XYZ(WEB-INF is common for both of XYZ and abc).
 We are configuring log4j from java class file.We can not
 add/modify/delete
 XYZ's log4j configuration property file.At present we are getting even
 the
 XYZ's logs in our log files.

 Please find our log4j configuration(abc's)

 log4j.appender.mail.layout=org.apache.log4j.PatternLayout
 [EMAIL PROTECTED]
 log4j.appender.mail=org.apache.log4j.net.SMTPAppender
 log4j.appender.mail.SMTPPassword=xx
 log4j.appender.mail.BufferSize=512
 log4j.appender.R.layout.ConversionPattern=%d{ MMM dd HH\:mm\:ss} --
 %p
 -- %m%n
 log4j.appender.mail.evaluatorClass=com.CK.Evaluator
 log4j.appender.mail.SMTPUsername=siva
 log4j.appender.R.File=${ck.base}ck_logs.log
 log4j.rootCategory=debug, R,mail
 [EMAIL PROTECTED]
 log4j.appender.R.MaxBackupIndex=10
 log4j.appender.R=org.apache.log4j.RollingFileAppender
 log4j.appender.mail.Threshold=WARN
 log4j.appender.mail.layout.ConversionPattern=%d{ MMM dd HH\:mm\:ss}
 --
 %p -- %m%n
 log4j.appender.R.layout=org.apache.log4j.PatternLayout
 log4j.appender.R.MaxFileSize=100KB
 log4j.appender.mail.Subject=\=[SMTPAppender] Application message
 log4j.appender.mail.SMTPHost=mail.abc.com

 It(abc) works fine as a single application in tomcat6.
 But when XYZ starts using abc the problem occurs(XYZ is using Weblogic
 Application server).

 Is there way to get separate the logs in a same application with
 different
 log4j configuration property files.

 Thanks  Regards,
 Sivamma


 James Stauffer wrote:
 
  If xyz and abc are different web apps then moving log4j.jar and
  log4j.xml from common to WEB-INF/lib should keep the logs separate.
  If they are in the same web app then they probably have different
  logger name roots so you can configure each to use a different
  appender. (i.e com.abc uses one appender and com.xyz uses another
  appender).
 
  On 6/25/07, sivamma [EMAIL PROTECTED] wrote:
 
  Hi,
I have a requirement to create different log files in same
  application.Our
  application will be used in a different web application.Even the other
  application is using log4j.We have our own log4j configuration
  property(WEB-INF/config.properties) file and separate log file in a
  particular directory(WEB-INF/logs/xxx.log).
 
  At present the problem is we are getting logs from other application
 to
  our
  log file.
  Our application(Giving  as jar files) is under other application.
 
  For example our application is abc and others is xyz.
 
  The directory structure is webapps/xyz/WEB-INF where it contains
 xyz's
  log4j property file as well abc's log4j property file.abc's logs are
  supposed to go webappas/xyz/WEB-INF/logs/abc.log and xyz's logs are
  supposed to go different file(Which we dont know , exactly where it
  goes).
  But at present xyz's logs are coming into abc's logs means , they are
  coming
  into webapps/xyz/WEB-INF/logs/abc.log
 
  Can you please tell me how can get logs only from my applicaiton(may
 not
  be
  from my application..only from  my classes).
 
  Its little urgent

Re: Urgent Please--How to create different log files with different property files in same webapplication

2007-06-25 Thread James Stauffer

How exactly is log4j configured from abc and xyz?  Directly through
code? Code referencing a config file?  log4j automatically finding a
config file?

On 6/25/07, sivamma [EMAIL PROTECTED] wrote:


Hi, Thank you for immediate reply.
The problem is little different here.XYZ and abc are in same application.XYZ
is using abc's jar files and jsps.
Our application(abc) have our own log4j configuration property file at
WEB-INF folder of XYZ(WEB-INF is common for both of XYZ and abc).
We are configuring log4j from java class file.We can not add/modify/delete
XYZ's log4j configuration property file.At present we are getting even the
XYZ's logs in our log files.

Please find our log4j configuration(abc's)

log4j.appender.mail.layout=org.apache.log4j.PatternLayout
[EMAIL PROTECTED]
log4j.appender.mail=org.apache.log4j.net.SMTPAppender
log4j.appender.mail.SMTPPassword=xx
log4j.appender.mail.BufferSize=512
log4j.appender.R.layout.ConversionPattern=%d{ MMM dd HH\:mm\:ss} -- %p
-- %m%n
log4j.appender.mail.evaluatorClass=com.CK.Evaluator
log4j.appender.mail.SMTPUsername=siva
log4j.appender.R.File=${ck.base}ck_logs.log
log4j.rootCategory=debug, R,mail
[EMAIL PROTECTED]
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.mail.Threshold=WARN
log4j.appender.mail.layout.ConversionPattern=%d{ MMM dd HH\:mm\:ss} --
%p -- %m%n
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.MaxFileSize=100KB
log4j.appender.mail.Subject=\=[SMTPAppender] Application message
log4j.appender.mail.SMTPHost=mail.abc.com

It(abc) works fine as a single application in tomcat6.
But when XYZ starts using abc the problem occurs(XYZ is using Weblogic
Application server).

Is there way to get separate the logs in a same application with different
log4j configuration property files.

Thanks  Regards,
Sivamma


James Stauffer wrote:

 If xyz and abc are different web apps then moving log4j.jar and
 log4j.xml from common to WEB-INF/lib should keep the logs separate.
 If they are in the same web app then they probably have different
 logger name roots so you can configure each to use a different
 appender. (i.e com.abc uses one appender and com.xyz uses another
 appender).

 On 6/25/07, sivamma [EMAIL PROTECTED] wrote:

 Hi,
   I have a requirement to create different log files in same
 application.Our
 application will be used in a different web application.Even the other
 application is using log4j.We have our own log4j configuration
 property(WEB-INF/config.properties) file and separate log file in a
 particular directory(WEB-INF/logs/xxx.log).

 At present the problem is we are getting logs from other application to
 our
 log file.
 Our application(Giving  as jar files) is under other application.

 For example our application is abc and others is xyz.

 The directory structure is webapps/xyz/WEB-INF where it contains xyz's
 log4j property file as well abc's log4j property file.abc's logs are
 supposed to go webappas/xyz/WEB-INF/logs/abc.log and xyz's logs are
 supposed to go different file(Which we dont know , exactly where it
 goes).
 But at present xyz's logs are coming into abc's logs means , they are
 coming
 into webapps/xyz/WEB-INF/logs/abc.log

 Can you please tell me how can get logs only from my applicaiton(may not
 be
 from my application..only from  my classes).

 Its little urgent.
 Thanks in advacne.
 Regards,
 Sivamma.
 --
 View this message in context:
 
http://www.nabble.com/Urgent-Please--How-to-create-different-log-files-with-different-property-files-in-same-webapplication-tf3974952.html#a11283346
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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




 --
 James Staufferhttp://www.geocities.com/stauffer_james/
 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]




--
View this message in context: 
http://www.nabble.com/Urgent-Please--How-to-create-different-log-files-with-different-property-files-in-same-webapplication-tf3974952.html#a11286397
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Urgent Please--How to create different log files with different property files in same webapplication

2007-06-25 Thread James Stauffer

So does only your customer have the problem of mixed logs?  It sounds
like they just need to change their config if they don't want mixed
logs.

But knowing how customers can be repository selectors might keep the
logs separate without the customer changing their config.

On 6/25/07, sivamma [EMAIL PROTECTED] wrote:


Yes thats true.
xyz uses abc as a library and abc runs by itself.


Can you better explain the relationship between abc and xyz?  It
sounds like xyz uses abc as a library and that abc also runs by
itself.

--
View this message in context: 
http://www.nabble.com/Urgent-Please--How-to-create-different-log-files-with-different-property-files-in-same-webapplication-tf3974952.html#a11287148
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Urgent Please--How to create different log files with different property files in same webapplication

2007-06-25 Thread James Stauffer

Search the mailing list archives.  I have never used them -- I am just
somewhat familiar with what they do.

On 6/25/07, sivamma [EMAIL PROTECTED] wrote:


Can you please explain me more.How to implement repository selectors.Please
send me some examples.
I tried to find in FAQs and some docs.But its not clear to me.

Thanks  Regards,
Sivamma.


So does only your customer have the problem of mixed logs?  It sounds
like they just need to change their config if they don't want mixed
logs.

But knowing how customers can be repository selectors might keep the
logs separate without the customer changing their config.


--
View this message in context: 
http://www.nabble.com/Urgent-Please--How-to-create-different-log-files-with-different-property-files-in-same-webapplication-tf3974952.html#a11288789
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: help to extend PatternLayout

2007-06-23 Thread James Stauffer

What are you trying to accomplish?

On 6/23/07, Naider Chen [EMAIL PROTECTED] wrote:

Hi:

I'm trying extend PatternLayout in order to intercept
log message.

The foremat method basically return all the log
message included in the ConversionPattern.  I'd like
to get the %m and do some pre-process and return it.
I'm not sure this is the way to get %m can anybody
help me with this.

Thanks.

Naider




Building a website is a piece of cake. Yahoo! Small Business gives you all the 
tools to get online.
http://smallbusiness.yahoo.com/webhosting

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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 Appender Piping and Rollover

2007-06-21 Thread James Stauffer

What does your custom appender do?  Look at how AsnycAppender sends
its output to another Appender.

DailyRollingFileAppender doesn't allow much variation between the
active and rolled filename.  Can you give an example of what you want?

On 6/21/07, ZalleCool [EMAIL PROTECTED] wrote:


Hi there,

I would like to be able to pipe the output of a custom appender to
DailyRollingFileAppender.  How can I do that?  Secondly, I want the name of
the active file to be different from that of the rolled over log files.  Is
this possible with DailyRollingFileAppender?



--
James Staufferhttp://www.geocities.com/stauffer_james/
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 Appender Piping and Rollover

2007-06-21 Thread James Stauffer

DailyRollingFileAppender won't do that but you might be able to make a
sub-class that would.

On 6/21/07, ZalleCool [EMAIL PROTECTED] wrote:

 DailyRollingFileAppender doesn't allow much variation between the
 active and rolled filename.  Can you give an example of what you want?

 DK:  The active file stays named as 'current' and the rolled over files
 get named as SomeService.log.20071206


--
James Staufferhttp://www.geocities.com/stauffer_james/
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: How to add appender dynamically to log4j.xml file

2007-06-19 Thread James Stauffer

Appenders can be added on the fly but there isn't anything that will
write the new log4j.xml.

You can get the attached appenders from the logger.

On 6/19/07, Ashish Gupta [EMAIL PROTECTED] wrote:

Hi,

I'm using log4j in my application for logging purpose. My requirement
is to add a new appender on the fly to log4j.xml file persistenlty
while the application is running on JBoss Server.

I tried with log4j  DOMConfigurator.configure() method which loads
the log4j.xml file in memory but didn't find any method in
DOMConfigurator API which allows to add new appender on the fly to
log4j.xml file.

Would appreciate the response.

Thanks,
Ashish


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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]



JDK logging appender that sends events to log4j

2007-06-19 Thread James Stauffer

Has anyone made a JDK logging appender that sends events to log4j?

This would achieve much the same benefit of commons-logging without
any extra downloads when log4j isn't used.

I.e. I would like to use JDK logging on the client and log4j on the server.

--
James Staufferhttp://www.geocities.com/stauffer_james/
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: JDK logging appender that sends events to log4j

2007-06-19 Thread James Stauffer

That appears to be the reverse of my idea.

On 6/19/07, Scott Deboy [EMAIL PROTECTED] wrote:

A recent contribution:

http://issues.apache.org/bugzilla/show_bug.cgi?id=42664

Looks like a great idea to me.

Scott Deboy
Principal Engineer
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR  97201
Office: 503.224.7496
Direct Line: 503.821.6482
Cell: 503.997.1367
Fax: 503.222.0185
[EMAIL PROTECTED]
www.comotivsystems.com


-Original Message-
From: James Stauffer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 19, 2007 2:07 PM
To: Log4J Users List
Subject: JDK logging appender that sends events to log4j

Has anyone made a JDK logging appender that sends events to log4j?

This would achieve much the same benefit of commons-logging without
any extra downloads when log4j isn't used.

I.e. I would like to use JDK logging on the client and log4j on the
server.

--
James Staufferhttp://www.geocities.com/stauffer_james/
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 Staufferhttp://www.geocities.com/stauffer_james/
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: How can i change the property in PropertyConfigurator

2007-06-13 Thread James Stauffer

I for one don't understand what exactly you want to do.  What is the
property that you want to change?

On 6/12/07, Meryl Silverburgh [EMAIL PROTECTED] wrote:

Hi,

I load log4j property using this a properties file:

PropertyConfigurator.configure(Download.class
.getResource(log4j.properties));

can you please tell me how can I change the property in the
PropertyConfigurator after I load it via a property file?

Thank you.

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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 with jboss, separate logging from app and jboss logging

2007-06-13 Thread James Stauffer

Give your app a separate logging repository and the logs will stay separate.

On 6/13/07, Ramming, Kai-Michael [EMAIL PROTECTED] wrote:


Hi,

i'm trying to seperate the logs(files) created by my app from the JBoss
log. I'm writing my own two
files with the logging in my app.
My Problem is, how can I prevent app loggings getting logged in the
JBoss logging? I only want
them in the especially files, not in the console or the Serverlog.

I dont want to edit the log4j.xml in the Jboss because I want to have
the possibility to change the
App Server whenever I want.

Thanks Kai

***
Hinweis:
Der Inhalt des erhaltenen E-Mails ist vertraulich zu behandeln und nur fuer den 
Adressaten/Vertreter bestimmt.
Wir machen darauf aufmerksam, dass der E-Mail-Inhalt aus Rechts- und 
Sicherheitsgruenden nicht rechtsverbindlich ist. Eine rechtsverbindliche 
Bestaetigung erhalten Sie gerne auf Anfrage in schriftlicher Form.
Eine Veroeffentlichung, Vervielfaeltigung oder Weitergabe des E-Mail-Inhaltes 
ist nur mit unserer schriftlichen Erlaubnis gestattet.
Aussagen oder Informationen an den Adressaten unterliegen dem Recht des 
Geschaeftes, zu welchem diese erfolgten; hierbei sind die zutreffenden 
Allgemeinen Geschaefts- oder Versicherungsbedingungen sowie individuelle 
Vereinbarungen zu beachten.
Sollten Sie nicht der fuer unsere Nachricht vorgesehene Empfaenger sein, so 
bitten wir Sie, sich mit dem Versender dieser E-Mail umgehend in Verbindung zu 
setzen und anschliessend die empfangene Sendung aus Ihrem System zu loeschen.



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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: how to disable framework logging

2007-06-07 Thread James Stauffer

AFAIK the root logger should be the last logger.  BTW category has
been superseeded by logger

On 6/7/07, jsobieski [EMAIL PROTECTED] wrote:


Hi,

I am having problem with Tapestry framework logging lots of debug statements
but I guess this question is more generic, in how to disable logging for any
framework that my code may be using.

My web application is built on top of Tapestry and I want to see only my
application's log statements. Tapestry is using org.apache.tapestry
namespace and so I configured my log4j.xml as following:

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd

log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;

  appender name=console class=org.apache.log4j.ConsoleAppender

layout class=org.apache.log4j.PatternLayout

/layout
  /appender

  !-- An appender which writes to file --
  appender name=main class=org.apache.log4j.DailyRollingFileAppender



layout class=org.apache.log4j.PatternLayout

/layout
  /appender

  !-- An appender which writes to file --
  appender name=tapestry
class=org.apache.log4j.DailyRollingFileAppender



layout class=org.apache.log4j.PatternLayout

/layout
  /appender

  root
priority value=error additivity=false /
appender-ref ref=console /
  /root

  category name=org.apache.tapestry additivity=false
priority value=error /
appender-ref ref=tapestry /
  /category

  category name=com.kkamerica.productcreator additivity=false
priority value=debug/
appender-ref ref=main/
  /category

/log4j:configuration

Yet, Tapestry is still logging at DEBUG into my application's log file
(prodc.log). Is my configuration incorrect or what else may I be doing
wrong?

Thanks, Jessica.
--
View this message in context: 
http://www.nabble.com/how-to-disable-framework-logging-tf3884588.html#a11010395
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Great product like log4j stagnant?

2007-06-05 Thread James Stauffer

I believe Ceki has designed logback as a replacement for log4j but
log4j is controlled by apache so it will determine if development of
log4j continues or not.  i.e. log4j and logback will probably compete
to be the best logging library and we will reap the benefits. :-)

On 6/5/07, Wayne Cannon [EMAIL PROTECTED] wrote:

I heard that too, but it was from the author in response to purchasing
his log4j documentation -- a reputable, but not exactly unbiased,
source.  I haven't heard any more about logback from any other source.
--Wayne

Arthur Blake wrote:
 I thought logback would be the eventual replacement of log4j...

 http://logback.qos.ch/



 - Original Message 
 From: Wayne Cannon [EMAIL PROTECTED]
 To: Log4J Users List log4j-user@logging.apache.org
 Sent: Tuesday, June 5, 2007 11:43:28 AM
 Subject: Great product like log4j stagnant?

 In a different thread, Steve Souza said that log4j development had
 stagnated (my words, not his, re version 1.3).  Is this true?  If this
 is true, is it simply because log4j is a mature product and is a good
 product needing little ongoing development effort of significance, or is
 there a new/replacement product carrying the de facto logging charter
 into the future (e.g. compatible with commons-logging)?

 Respectfully,
 Wayne


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








   

 Park yourself in front of a world of choices in alternative vehicles. Visit 
the Yahoo! Auto Green Center.
 http://autos.yahoo.com/green_center/


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Proper startup order?

2007-06-04 Thread James Stauffer

Is it possible that log4j is being configured twice because AFAIK
configuration doesn't happen in the background?

Also log4j config messages aren't generally sent to your logs unless
you have log4j debugging turned on and use a ConsoleAppender.

On 5/26/07, Rich Adili [EMAIL PROTECTED] wrote:

Hi,

I'm rather new to logging and having some trouble pinning down the
proper startup sequence. Current code appears below. If dosomething
writes to the log, the output is mingled with the log4j initialization
output. Users find this rather confusing. How can I delay my stuff until
log4j has finished speaking its piece?

DOMConfigurator.configureAndWatch(conf/log4j.xml);

org.apache.commons.logging.Log log =
LogFactory.getFactory().getInstance(Xatanet.class);

dosomething(log);


Rich

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Threadlogging

2007-06-04 Thread James Stauffer

This was just discussed. See
http://www.nabble.com/DailyRollingFileAppender-for-multiple-threads-tf3752882.html#a1084

On 5/30/07, Daniel Abrecht [EMAIL PROTECTED] wrote:


Can i configure Log4j that i get for eacht java-thread a log file?
--
View this message in context: 
http://www.nabble.com/Threadlogging-tf3840256.html#a10873317
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: File and Console Appenders question

2007-06-04 Thread James Stauffer

1. No.
2,3. http://logging.apache.org/log4j/docs/manual.html
4.  Attach two appenders to the one logger.
5. No.


On 6/1/07, untz [EMAIL PROTECTED] wrote:

Hello there,

I am using an init servlet to load my log4j.properties file during app start 
up...
public class Log4jInitServlet extends HttpServlet {
 public void init() throws ServletException {
Properties props = new Properties();
try {
props.load(this.getClass().getClassLoader().getResourceAsStream(
/log4j.properties));
} catch (IOException e) {
   e.printStackTrace();
}
}
}
 The log4j.properties file:
log4j.rootLogger=WARN, stdout
log4j.logger.acme.myapp=DEBUG
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
 Question(s):

(1)
Let's say I want to use a file appender for logging different parts of
the app's behavior, do I need to create a different properties file?

(2) If not, how would I integrate that with the properties file above?

(3) Is there a way I set the DEBUG warning to just log to the Console and the 
LOG warning to just log to specific files (which I specify)?

(4) What if I wanted two separate log files generated for the file appender?

(e.g. one being for cars.log and another one being planes.log)

(5) Do I have to create a different init servlet and different properties file?

Happy programming,




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Exception while Application run on CD/DVD

2007-05-24 Thread James Stauffer

Your config is probably setup to write a file to the CD which is read-only.

On 5/24/07, Laxmilal Menaria [EMAIL PROTECTED] wrote:

Hello everyone,

I am using Log4j for logging in my products. This is working fine on my hard
drive, all logging are works. But if copied my application on CD/DVD then
log4j gives exception, I want if log4j die then Application should works.

I am getting the following exception while running on CD/DVD;

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: Logs\MyInfo.log (Access is denied)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.init(Unknown Source)
at java.io.FileOutputStream.init(Unknown Source)
at org.apache.log4j.r.a(Unknown Source)
at org.apache.log4j.r.f(Unknown Source)
at org.apache.log4j.s.f(Unknown Source)
at myapplication.ainit(Unknown Source)
at myapplication.main(Unknown Source)

Please suggest me..
--
Thanks,
Laxmilal menaria

http://www.minalyzer.com/
http://www.chambal.com/




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Third Party Appenders

2007-05-23 Thread James Stauffer

Depending on they number of distinct messages that interests, you
could have separate appenders for each message (using filters).
Depending on the volume you may only want to roll weekly or monthly so
that tail would work better.  Or you could just have a program that
checks the special appenders for an increase in size.

On 5/23/07, Roger Varley [EMAIL PROTECTED] wrote:

Hi

Is there an appender that will allow me to monitor for a specific
message or list of specific messages and allow me to trigger an action
against those messages. I may need a different action for each
message.

Background.

I'm supporting a third party java web application. I don't have access
to the source code nor am I allowed to de-compile and modify the
source code. However, the application is using log4j for it's logging.
At the moment I'm manually monitoring the logfiles for the appearance
of specific messages and manually taking action based on those
messages.

I've tried writing a unix like tail program to monitor the logfile
directly but this fails overnight when the logfile rolls over to a new
logfile. So I thought that adding my own appender might be a more
elegant solution. I'm quite prepared to have a go at doing this myself
but I thought that I would check first in case this has already been
done. I'd also be grateful for alternate suggestions if it is
generally felt that this is not a good idea.

Regards
Gilbert

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Logger level being ignored

2007-05-23 Thread James Stauffer

Your configuration looks correct.  You could run with -Dlog4j.debug to
verify that is is being used.

On 5/23/07, ben short [EMAIL PROTECTED] wrote:

Hi,

I have an application that uses the apache HTTPClient. With my
applications logging setup in debug mode the HTTPClient spits out lots
of info to the log file. I have setup a logger as shown in the
following log4j.xml, But it seems to be ignored and i see the following
in my log file. I also have a logger setup for the spring framework
which works fine. Can anyone see what if doing wrong? I'm using log4j
1.2.14.


10:23:11,714 DEBUG org.apache.commons.httpclient.Wire:69 -  /div[\r][\n]
10:23:11,717 DEBUG org.apache.commons.httpclient.Wire:69 -  [\r][\n]
10:23:11,720 DEBUG org.apache.commons.httpclient.Wire:69 -  !--
SiteCatalyst code version: H.6.[\r][\n]
10:23:11,724 DEBUG org.apache.commons.httpclient.Wire:69 - 
Copyright 1997-2006 Omniture, Inc. More info available at[\r][\n]



?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration

appender name=FILE class=org.apache.log4j.RollingFileAppender
param name=maxFileSize value=128MB /
param name=maxBackupIndex value=5 /
param name=File value=${catalina.home}/logs/jc_core.log /
param name=threshold value=DEBUG/
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=%d{ABSOLUTE} %5p %C:%L - 
%m%n /
/layout
/appender


logger name=org.springframework level value=WARN//logger

logger name=org.apache.commons.httpclient level value=WARN//logger


!--   --
!-- setup log4j's root logger --
!--   --
root
level value=all /
appender-ref ref=FILE/
/root
/log4j:configuration

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Logger level being ignored

2007-05-23 Thread James Stauffer

That all looks fine except I am not sure if lines 3-4 are ok.  Are you
using automatic config with log4j.xml in your classpath?  Are you sure
nothing else is configuring log4j?

On 5/23/07, ben short [EMAIL PROTECTED] wrote:

Heres my output with -Dlog4j.debug. Seems to show the correct setup of
the logger.

log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
log4j:WARN No appenders could be found for logger
(org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.
log4j: System property is :null
log4j: Standard DocumentBuilderFactory search succeded.
log4j: DocumentBuilderFactory is:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
log4j: debug attribute= null.
log4j: Ignoring debug attribute.
log4j: Threshold =null.
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [org.springframework] additivity to [true].
log4j: Level value for org.springframework is  [WARN].
log4j: org.springframework level set to WARN
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [org.apache.commons.httpclient] additivity to [true].
log4j: Level value for org.apache.commons.httpclient is  [WARN].
log4j: org.apache.commons.httpclient level set to WARN
log4j: Level value for root is  [all].
log4j: root level set to ALL
log4j: Class name: [org.apache.log4j.RollingFileAppender]
log4j: Setting property [maxFileSize] to [128MB].
log4j: Setting property [maxBackupIndex] to [5].
log4j: Setting property [file] to [/opt/apache-tomcat-5.5.23/logs/jc_core.log].
log4j: Setting property [threshold] to [DEBUG].
log4j: Parsing layout of class: org.apache.log4j.PatternLayout
log4j: Setting property [conversionPattern] to [%d{ABSOLUTE} %5p %C:%L - %m%n].
log4j: setFile called: /opt/apache-tomcat-5.5.23/logs/jc_core.log, true
log4j: setFile ended
log4j: Adding appender named [FILE] to category [root].

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Logger level being ignored

2007-05-23 Thread James Stauffer

The level setting should allow only WARN and higher logs to get to the
root logger even with additivity set to true.

On 5/23/07, Gallagher, Ron [EMAIL PROTECTED] wrote:

Ben --

Here's your problem:

log4j: Setting [org.apache.commons.httpclient] additivity to [true].

With the additivity of the org.apache.commons.httpclient logger set to
true, any logging output that is processed by the
org.apache.commons.httpclient will also be processed by any explicitly
configured loggers in it's ancestry, including the 'root' logger.

To change this behavior, just set the additivity on the
org.apache.commons.httpclient to false.

logger name=org.apache.commons.httpclient additivity=falselevel
value=WARN//logger

Ron Gallagher, ATT Mobility

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
ben short
Sent: Wednesday, May 23, 2007 10:54 AM
To: Log4J Users List
Subject: Re: Logger level being ignored

Heres my output with -Dlog4j.debug. Seems to show the correct setup of
the logger.

log4j: Trying to find [log4j.properties] using
ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
log4j:WARN No appenders could be found for logger
(org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.
log4j: System property is :null
log4j: Standard DocumentBuilderFactory search succeded.
log4j: DocumentBuilderFactory is:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
log4j: debug attribute= null.
log4j: Ignoring debug attribute.
log4j: Threshold =null.
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [org.springframework] additivity to [true].
log4j: Level value for org.springframework is  [WARN].
log4j: org.springframework level set to WARN
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [org.apache.commons.httpclient] additivity to [true].
log4j: Level value for org.apache.commons.httpclient is  [WARN].
log4j: org.apache.commons.httpclient level set to WARN
log4j: Level value for root is  [all].
log4j: root level set to ALL
log4j: Class name: [org.apache.log4j.RollingFileAppender]
log4j: Setting property [maxFileSize] to [128MB].
log4j: Setting property [maxBackupIndex] to [5].
log4j: Setting property [file] to
[/opt/apache-tomcat-5.5.23/logs/jc_core.log].
log4j: Setting property [threshold] to [DEBUG].
log4j: Parsing layout of class: org.apache.log4j.PatternLayout
log4j: Setting property [conversionPattern] to [%d{ABSOLUTE} %5p %C:%L -
%m%n].
log4j: setFile called: /opt/apache-tomcat-5.5.23/logs/jc_core.log, true
log4j: setFile ended
log4j: Adding appender named [FILE] to category [root].

-
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 Staufferhttp://www.geocities.com/stauffer_james/
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: logging from commons.httpclient interferes with application logging

2007-05-22 Thread James Stauffer

That looks correct except that I think level should be the first
child of logger

On 5/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi all,
I'm using Jakarta Commons HttpClient for simulating test requests to
my web application. There I have configured log4j for logging at debug
level. But now the output from HttpClient wastes my logfile. How can I
configure log4j so that the output from a different package is logged
to an other file? I'm using XML configuration. Here is my log4j.xml:

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;

appender name=appender class=org.apache.log4j.FileAppender
  param name=File value=myApp-debug.log/
  param name=Append value=true/
  layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=%d{ISO8601} [%X
{SessID}] %m%n/
  /layout
/appender
appender name=errappender class=org.apache.log4j.FileAppender

  param name=File value=error.log/
  param name=Append value=true/
  layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=%d{ISO8601} [%X
{SessID}] %m%n/
  /layout
filter class=org.apache.log4j.varia.LevelRangeFilter
param name=LevelMin value=error /
param name=LevelMax value=fatal /
/filter
/appender
appender name=testappender class=org.apache.log4j.FileAppender
param name=File value=test.log/
param name=Append value=true/
  layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=%-5p [%t] %c - %m: %d{DATE}%n
/
  /layout
/appender

root
  priority value=debug/
  appender-ref ref=appender/
  appender-ref ref=errappender/
/root
logger name=org.apache.commons.httpclient  additivity=false
appender-ref ref=lasttestappender/
  level value=error/
/logger
/log4j:configuration

Thanks in advance,
Ralf H.


Jetzt neu: Der Routenplaner von Tiscali
http://www.tiscali.de/trav/routenplaner.html


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Re[2]: logging from commons.httpclient interferes with application logging

2007-05-22 Thread James Stauffer

Maybe providing some of the lines that go to your mail appender would help.

On 5/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



Ursprüngliche Nachricht
Von: [EMAIL PROTECTED]
Datum: 22.05.2007 14:35
An: Log4J Users Listlog4j-user@logging.apache.org,
[EMAIL PROTECTED][EMAIL PROTECTED]
Betreff: Re: logging from commons.httpclient interferes with
application logging

That looks correct except that I think level should be the first
child of logger


Hi James,
thanks for your fast answer, but this only corrected some error
messages from HTTPClient (didn't know that the order of entries plays a
role). The HTTP output appears further in my logfile. Perhaps I will
try to put this question to httpclient mailing list.


On 5/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi all,
 I'm using Jakarta Commons HttpClient for simulating test requests
to
 my web application. There I have configured log4j for logging at
debug
 level. But now the output from HttpClient wastes my logfile. How
can I
 configure log4j so that the output from a different package is
logged
 to an other file? I'm using XML configuration. Here is my log4j.
xml:

 ?xml version=1.0 encoding=UTF-8 ?
 !DOCTYPE log4j:configuration SYSTEM log4j.dtd
 log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;


 appender name=appender class=org.apache.log4j.FileAppender

   param name=File value=myApp-debug.log/
   param name=Append value=true/
   layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%d{ISO8601} [%X
 {SessID}] %m%n/
   /layout
 /appender
 appender name=errappender class=org.apache.log4j.
FileAppender
 
   param name=File value=error.log/
   param name=Append value=true/
   layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%d{ISO8601} [%X
 {SessID}] %m%n/
   /layout
 filter class=org.apache.log4j.varia.LevelRangeFilter
 param name=LevelMin value=error /
 param name=LevelMax value=fatal /
 /filter
 /appender
 appender name=testappender class=org.apache.log4j.FileAppender

 param name=File value=test.log/
 param name=Append value=true/
   layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%-5p [%t] %c - %m: %d{DATE}%
n
 /
   /layout
 /appender

 root
   priority value=debug/
   appender-ref ref=appender/
   appender-ref ref=errappender/
 /root
 logger name=org.apache.commons.httpclient  additivity=false
 appender-ref ref=lasttestappender/
   level value=error/
 /logger
 /log4j:configuration

 Thanks in advance,
 Ralf H.


 Jetzt neu: Der Routenplaner von Tiscali
 http://www.tiscali.de/trav/routenplaner.html



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




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




Jetzt neu: Der Routenplaner von Tiscali
http://www.tiscali.de/trav/routenplaner.html


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Getting started with log4j...

2007-05-22 Thread James Stauffer

I don't see anything wrong but I use automatic XML config so I am not
familiar with code config.  You may want to try XML config.

On 5/22/07, Redefined Horizons [EMAIL PROTECTED] wrote:

I was just about to write some debug code by hand in my Java classes
when I remembered reading about log4j. I checked out the website and
it seemed to do exactly what I needed, only better. I have decided to
give it a try.

However, after reading a couple of the tutorials and the online manual
I find myself running into some trouble. I'm trying to use a logger
with a FileAppender, but when I execute my program no messages are
ever written to the text file. I know the method with the logging code
is being executed because it appears in a stack trace from an
exception that is generated shortly after the logging code.

In my logging code I create a Logger, create a Layout, and then create
a FileAppender passing a simple layout, the name of a text file, and a
boolean value of true. I then associate the FileAppender with the
Logger and write two messages.

When I open the text file identified in my code it is empty.

What step am I missing? (I create a text file with the correct name
before executing the logging code.)

Thanks in advance for the help.

Scott Huey,

P.S. - I'm using the latest stable release of log4j, Eclipse 3.2.1 and
my operating system is Microsoft Windows.

Here is some of my logging code:

/*
* Set up logging code here.
*/
Logger myLogger =
Logger.getLogger(com.vividsolutions.jump.workbench.ui.LayerViewPanel.class);
SimpleLayout layout = new SimpleLayout();

FileAppender appender = null;

try
{
 appender = new FileAppender(layout, debug_log.txt, true);
}

catch(Exception thisException)
{
 System.err.println(thisException.getMessage());
}

myLogger.addAppender(appender);

Iterator loopThrough = contentIDs.iterator();

myLogger.info(This is a test.);

while(loopThrough.hasNext())
{
 Object contentID = loopThrough.next();
 Class contentIDClass = contentID.getClass();
 String className = contentIDClass.getName();
 myLogger.fatal(The class we couldn't find a renderer for was: 
+ className);
}

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: DailyRollingFileAppender for multiple threads

2007-05-15 Thread James Stauffer

Starting points:
http://marc.info/?l=log4j-userm=11673276105w=2
http://marc.info/?l=log4j-userm=116056967826476w=2
http://marc.info/?l=log4j-userm=114105274201875w=2

It is similar to the problem of one file per user.

On 5/15/07, rovelgoenne [EMAIL PROTECTED] wrote:


Thanks for your reply. I searched around in this forum for this topic the
last days. I found some topics very simular to the one I described. But I
didn't find a good solution or an appender.
Perhaps someone can give me an advice.


James Stauffer wrote:

 Search the archives.  One file per thread has been discussed and I
 think someone made an appender that does it.

 On 5/14/07, rovelgoenne [EMAIL PROTECTED] wrote:

 I start multiple threads where every thread should log to his own file.
 Therefor I did:
 - every thread has a number
 - for every thread I get a logger with name + number
 - in every logger I add an DailyRollingFileAppender
 - in the thread I log to the connected logger
 So everything works fine. Every thread logs to his file.

 Code (initialization):
 DailyRollingFileAppender fileAppender;
 for ( int i = 0; i  multiplicity; i++ )
 {
 fileAppender = new DailyRollingFileAppender( layout,
 c:/log/temp + i + .log '.'-MM-dd );
 Logger logger = Logger.getLogger( logger + i );
 logger.addAppender( fileAppender );
 }

 There is only a problem in heavy logging in all threads. In this
 situation
 sometimes logging entries (or parts of it) from one thread show up in the
 logging file of another thread.
 Has someone an idea about the reason of such an behavour? Is my solution
 not
 suitable for such a problem?
 Do I have to use a different appender (because of the amount of logging
 entries I have to use something like DailyRollingFileAppender)?
 I searched the hole mailing list for an answer but I didn't found
 something
 about these exact problem.
 --
 View this message in context:
 
http://www.nabble.com/DailyRollingFileAppender-for-multiple-threads-tf3752882.html#a10605350
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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




 --
 James Staufferhttp://www.geocities.com/stauffer_james/
 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]




--
View this message in context: 
http://www.nabble.com/DailyRollingFileAppender-for-multiple-threads-tf3752882.html#a10617864
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: DailyRollingFileAppender for multiple threads

2007-05-14 Thread James Stauffer

Search the archives.  One file per thread has been discussed and I
think someone made an appender that does it.

On 5/14/07, rovelgoenne [EMAIL PROTECTED] wrote:


I start multiple threads where every thread should log to his own file.
Therefor I did:
- every thread has a number
- for every thread I get a logger with name + number
- in every logger I add an DailyRollingFileAppender
- in the thread I log to the connected logger
So everything works fine. Every thread logs to his file.

Code (initialization):
DailyRollingFileAppender fileAppender;
for ( int i = 0; i  multiplicity; i++ )
{
fileAppender = new DailyRollingFileAppender( layout,
c:/log/temp + i + .log '.'-MM-dd );
Logger logger = Logger.getLogger( logger + i );
logger.addAppender( fileAppender );
}

There is only a problem in heavy logging in all threads. In this situation
sometimes logging entries (or parts of it) from one thread show up in the
logging file of another thread.
Has someone an idea about the reason of such an behavour? Is my solution not
suitable for such a problem?
Do I have to use a different appender (because of the amount of logging
entries I have to use something like DailyRollingFileAppender)?
I searched the hole mailing list for an answer but I didn't found something
about these exact problem.
--
View this message in context: 
http://www.nabble.com/DailyRollingFileAppender-for-multiple-threads-tf3752882.html#a10605350
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Time stamp in file name

2007-04-20 Thread James Stauffer

My DateFormatFileAppender always includes the data pattern in the filename.
http://stauffer.james.googlepages.com/DateFormatFileAppender.java

On 4/20/07, Hjelmstad [EMAIL PROTECTED] wrote:


Is there a way that I can add a timestamp to the file name that is not just a
rolling appender?
I may start up and stop my software 10 or more times during the course of a
day and between those I have to remane the log file created manually.
Does any one know of a way to automatically add a timestamp to the file name
at the start of the software initialization?
--
View this message in context: 
http://www.nabble.com/Time-stamp-in-file-name-tf3619129.html#a10105185
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: AsyncAppender Issue

2007-04-10 Thread James Stauffer

How are you configuring AsyncAppender.  I think it has an option that
throws away logs when the buffer is full.

On 4/10/07, Luedecke, Michael J [EMAIL PROTECTED] wrote:

I'm losing logs when I use the AsyncAppender for some reason.  This loss
of logs occurs whether I'm using a custom appender or out-of-the-box
appender (i.e. FileAppender).

I have not noticed this problem when I send a string in the log method
call.  It only seems to happen when I pass an object in the log method
call.  The object I'm sending in the log is not large or complex.  It is
a HashMap collection containing only 5 or 6 entries.

The logs that get created successfully varies.  Sometimes I get all of
the logs I'm expecting, but, most of the time I don't.  If I use the
appenders without the AsyncAppender I'm consistently getting all of the
expected logs.

I'm not creating a large number of logs (my test case only creates 3
logs).  Nevertheless, I have tried to change all of the options used by
the AsyncAppender just in case, but it has not resolved anything.

Other characteristics of my environment:
* Using log4j 1.2.14
* Using JDK 1.4.2_14
* OS is Windows XP

Has anyone else experienced this type of behavior with the
AsyncAppender?

Thanks.






--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Conditionaly sending email with Log4j

2007-03-28 Thread James Stauffer

One option would be to have separate loggers per form and then only
attach the appender to the desired logggers.  Note that SMTPAppender
only sends email when it encounters and error (or higher) level
logger..

On 3/27/07, tyson magney [EMAIL PROTECTED] wrote:

I have an electronic forms processing application that releases documents to
a database.  When an exception occurs, the app needs to send an email to an
admin depending on which form threw the exception.  I already have lo4j in
place with an SMTP appender configured.  What I cannot figure out is, how do
I conditionaly send emails?  I could setup multiple SMTP appenders, but how
would log4j know which appender to use when a particular form throws an
exception?

The best solution I can come up with, is to subclass SMTPAppender and
override sendBuffer().  When sendBuffer is called, the appender name would
be compared to a value stored in the MDC. If a match  is found then
super.sendBuffer would be called.  Cany anyone think of a better solution?

Thanks.

- Tyson




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Enh rqst: a variation on DailyRollingFileAppender

2007-03-24 Thread James Stauffer

Can you give details so I can determine if my appender has similiar problems?

On 3/23/07, Curt Arnold [EMAIL PROTECTED] wrote:


On Mar 23, 2007, at 1:12 PM, James Stauffer wrote:

 What problem are there?  I am using my DateFormatFileAppender
 extensively in production (web app) and haven't noticed any issues.


The comment only applied to org.apache.log4j.RollingFileAppender and
org.apache.log4j.DailyRollingFileAppender.  I did not mean to make
any statement on your DateFormatFileAppender.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Custom appender question about getRenderedMessage()

2007-03-23 Thread James Stauffer

If you want to change the text of the message, you shouldn't do that
in the appender -- the layout is a much better place to do that.

Can you just change your ConversionPattern to the following and not
subclass RollingFileAppender?
my custom text %d %5p [%t][%40C::%-20M(%3L)]-%m%n

On 3/22/07, Bret Schuhmacher [EMAIL PROTECTED] wrote:

Hi,

I'm trying to extend RollingFileAppender.  I want to manipulate the
*complete* message that's logged by prepending something to the message
just before it's dumped into the file.

My custom class's append() tries to create a new LoggingEvent from the
given LoggingEvent, prepending my text to the
event.getRenderedMessage(), then calls super.append(myNewLoggingEvent).
Unfortunately,  getRenderedMessage just returns the original message I
wanted logged, not the full message rendered with my ConversionPattern.
My ConversionPattern is set to this, btw:
%d %5p [%t][%40C::%-20M(%3L)]-%m%n

Said another way, I want this:
logger.debug(my message);

to get rendered and written to file like this:
my custom text 2007-03-22 19:05:05,615 DEBUG
[main][com.xx.TestMain::init ( 26)]-my message

Is there a way to make this happen?  I can't seem to get my hands on the
full, rendered message (2007-03-22 19:05:05,615 DEBUG
[main][com.xx.TestMain::init ( 26)]-my message) so I can prepend
my custom text.

I've tried creating an ObjectRenderer, too, but I don't think that's the
way I should go (is it?).  If I could grab the full rendered message and
prepend my String and then *reset* the rendered message I think I'd be
fine, but I'm not sure...

FWIW, I'm using 1.2.14.


Thanks!

Bret



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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Custom appender question about getRenderedMessage()

2007-03-23 Thread James Stauffer

I would extend PatternLayout to change the message and only extend
RollingFileAppender to alter the rollOver functionality.

On 3/23/07, Bret Schuhmacher [EMAIL PROTECTED] wrote:

Thanks, James.  I did more digging around and was able to add a %s to
my ConversionPattern using a custom PatternLayout subclass.  I can get
my custom text to print out where I want now.

BUT - the custom text is based on the rest of the row - there is some
amount of calculation that must be done based on the contents of the
rest of the row.  I need to get the *fully rendered message* as it would
be written to the file so I can do the calculations and create the
custom text that goes on the front.  In addition, I need to alter the
rollOver functionality, so I think subclassing the RollingFileAppender
is needed.

Unfortunately, getRenderedMessage just returns the original text of the
message to be logged, not the message that has all the modifiers
replaced (i.e. with time, thread, class, etc.).  Is it possible to get
the fully rendered message?

Thanks,

Bret


 -Original Message-
 From: James Stauffer [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 23, 2007 10:03 AM
 To: Log4J Users List
 Subject: Re: Custom appender question about getRenderedMessage()

 If you want to change the text of the message, you shouldn't do that
in
 the appender -- the layout is a much better place to do that.

 Can you just change your ConversionPattern to the following and not
 subclass RollingFileAppender?
 my custom text %d %5p [%t][%40C::%-20M(%3L)]-%m%n

 On 3/22/07, Bret Schuhmacher [EMAIL PROTECTED] wrote:
  Hi,
 
  I'm trying to extend RollingFileAppender.  I want to manipulate the
  *complete* message that's logged by prepending something to the
  message just before it's dumped into the file.
 
  My custom class's append() tries to create a new LoggingEvent from
 the
  given LoggingEvent, prepending my text to the
  event.getRenderedMessage(), then calls
 super.append(myNewLoggingEvent).
  Unfortunately,  getRenderedMessage just returns the original message
 I
  wanted logged, not the full message rendered with my
 ConversionPattern.
  My ConversionPattern is set to this, btw:
  %d %5p [%t][%40C::%-20M(%3L)]-%m%n
 
  Said another way, I want this:
  logger.debug(my message);
 
  to get rendered and written to file like this:
  my custom text 2007-03-22 19:05:05,615 DEBUG
  [main][com.xx.TestMain::init ( 26)]-my message
 
  Is there a way to make this happen?  I can't seem to get my hands on
  the full, rendered message (2007-03-22 19:05:05,615 DEBUG
  [main][com.xx.TestMain::init ( 26)]-my message) so I can
  prepend my custom text.
 
  I've tried creating an ObjectRenderer, too, but I don't think that's
  the way I should go (is it?).  If I could grab the full rendered
  message and prepend my String and then *reset* the rendered message
I
  think I'd be fine, but I'm not sure...
 
  FWIW, I'm using 1.2.14.
 
 
  Thanks!
 
  Bret
 
 
 
 
-
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 James Staufferhttp://www.geocities.com/stauffer_james/
 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 Staufferhttp://www.geocities.com/stauffer_james/
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: Enh rqst: a variation on DailyRollingFileAppender

2007-03-23 Thread James Stauffer

I wrote an appender that always uses the formatted name.
http://stauffer.james.googlepages.com/DateFormatFileAppender.java

On 3/23/07, Andrew Marlow [EMAIL PROTECTED] wrote:

guys,

I am using DailyRollingFileAppender to have an AM and PM log for each
day. This isn't quite what I want but is close enough for now. What I
would really like is an appender that writes directly to the target
file, rather than it writing it to a different file and rolling that
file over at a certain time. It's the rolling over that I don't like. I
have had some weird problems where log4j sometimes complains that it
cannot do the rollover at startup.

Here is an example of how a logger worked that I was using before I
started using log4j.

The logfile name was of the form prefixmmdd-w.txt where w is a
watch number. The day is divided into 6 watches of 4 hours each, i.e.
-0400, 0400-0800, 0800-1200, 1200-1600, 1600-2000 and
2000-2400. Each time a call is made to the logger it ensures that it is
writing to the correct logfile for the current watch. If the file exists
the record is appended, if the file does not exist it is created.

The advantage of this system is that you always know which logfile to
look at and you dont need to worry about rollover. Is there any chance
of log4j being able to offer this facility please?

Regards,

Andrew Marlow

There is an emerald here the size of a plover's egg!
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please  http://www.expita.com/nomime.html


**
The data and information (collectively called Information) herein is the sole 
property of ICAP.  The Information is confidential, may be legally privileged 
and is intended solely for the use of the individual or entity to whom it is 
addressed.  Unauthorised disclosure, copying or distribution of the Information 
is strictly prohibited and the recipient of the Information shall not 
redistribute the Information in any form to a third party.  If you received 
this Information in error please tell us by reply (or telephone the sender) and 
delete all copies on your system.

References in this Information to ICAP are references to ICAP plc, a company 
incorporated in England with registered number 3611426 whose registered office 
is 2 Broadgate, London, EC2M 7UR and where the context requires, includes its 
subsidiary and associated undertakings.  As applicable, certain companies 
within the ICAP group are authorised and regulated by the Financial Services 
Authority.  Any investment research sent from ICAP will provide an impartial 
and objective assessment of the securities, companies or other matters that are 
the subject of their research and our Conflicts of Interest Management Policy 
regarding investment research can be viewed by requesting a copy from your 
usual contact at ICAP.  Please visit www.icap.com for further regulatory 
information including details regarding the European eCommerce Directive.

***
We have taken precautions to minimise the risk of transmitting software viruses, but 
we advise you to carry out your own virus checks on any attachment to this message. 
We cannot accept liability for any loss or damage caused by software viruses. 
***


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Enh rqst: a variation on DailyRollingFileAppender

2007-03-23 Thread James Stauffer

What problem are there?  I am using my DateFormatFileAppender
extensively in production (web app) and haven't noticed any issues.

On 3/23/07, Curt Arnold [EMAIL PROTECTED] wrote:

The renaming and close then reopen logic in the rolling file
appenders are problematic.  There was some discussion and some code
on MultiFileAppender back in October that was trying to address
problems like having distinct log files per thread, but could also
address some of the same issues as the RollingFileAppenders but
without ever renaming files.  However, I got distracted and haven't
been able to get back to it.  Search the archives if you are
interested in the back story.


--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Introduction

2007-03-22 Thread James Stauffer

A few lines of the log file might be helpful.  BTW no included log4j
appenders create files with random names so if log4j is creating that
it is using a custom appender.

On 3/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hello,

My name is Jim McEvoy and I am a recent addition to the log4j user list.
Like all people who come onto this forum, I have questions. Hopefully
someday soon, I can provide answers as well.

Is anyone on this list familiar with Jdeveloper, and if so I have a
question as pertains to log files. We recently deployed a web application
and it correctly populates a log to the J2EE/Home/log area. However,
everytime someone logs into the app, another system generated log file is
created. The format of the file is BC34t4f42BCD, the letters and numbers
between BC and BCD are random. In the file, appears to be data as to what
is happening with the struts maybe? It shows who is using the app, what
views in the model they are calling, etc.

Can anyone help me out with figuring out what sort of file this is, where
it comes from, and how I can change where it is logged to? Currently, it
shows up in J2EE/Home and I'd like to change it to another directory.

Jim McEvoy
Systems Integrator
Bull Services
822 Centennial Way Ste. 100
Lansing, MI 48917
Phone: 517-327-2207




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Introduction

2007-03-22 Thread James Stauffer

I don't use the XML appender for log4j but that doesn't look like it
is from log4j.

On 3/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

James,

Thanks for your response. The log file looks like this:

AM MomVer=0
   cd/
   TXN Def=1 New=0 Lok=2/
   CONN/
   VO
  VO sig=1174524892108 da=1 It=1 St=0 ac=0 Ex=1
Def=model.MainScreenView Name=MainScreenView
 exArgs ct=1
arg
   ![CDATA[]]
/arg
 /exArgs
 Key
![CDATA[00010111772393CC]]
 /Key
  /VO
  VO sig=1174524892108 Def=model.aView Name=aView1/
  VO sig=1174524892108 Def=model.bView Name=bView1/
  VO sig=1174524892108 Def=model.cView Name=cView1/
  VO sig=1174524892108 Def=model.dView Name=dView1/
  VO sig=1174524892108 Def=model.eView Name=eView1/
  VO sig=1174524892108 Def=model.fView Name=fView1/


This is obviously not the whole file, but they are between 6 and 12K. I am
new to both Jdeveloper and log4j, so if this is a jdeveloper question in
fact, my mistake.

Thanks for any help you might be able to provide in advance!

Jim




James Stauffer [EMAIL PROTECTED]
03/22/2007 01:17 PM
Please respond to
Log4J Users List log4j-user@logging.apache.org


To
Log4J Users List log4j-user@logging.apache.org
cc

Subject
Re: Introduction






A few lines of the log file might be helpful.  BTW no included log4j
appenders create files with random names so if log4j is creating that
it is using a custom appender.

On 3/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hello,

 My name is Jim McEvoy and I am a recent addition to the log4j user list.
 Like all people who come onto this forum, I have questions. Hopefully
 someday soon, I can provide answers as well.

 Is anyone on this list familiar with Jdeveloper, and if so I have a
 question as pertains to log files. We recently deployed a web
application
 and it correctly populates a log to the J2EE/Home/log area. However,
 everytime someone logs into the app, another system generated log file
is
 created. The format of the file is BC34t4f42BCD, the letters and numbers
 between BC and BCD are random. In the file, appears to be data as to
what
 is happening with the struts maybe? It shows who is using the app, what
 views in the model they are calling, etc.

 Can anyone help me out with figuring out what sort of file this is,
where
 it comes from, and how I can change where it is logged to? Currently, it
 shows up in J2EE/Home and I'd like to change it to another directory.

 Jim McEvoy
 Systems Integrator
 Bull Services
 822 Centennial Way Ste. 100
 Lansing, MI 48917
 Phone: 517-327-2207



--
James Staufferhttp://www.geocities.com/stauffer_james/
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 Staufferhttp://www.geocities.com/stauffer_james/
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: Logging Domains

2007-03-22 Thread James Stauffer

What if you had loggers named normally.  Then to create your view,
create a separate appender and attach it to the loggers for that view.
i.e. Attach a DAOAppender to all DAO loggers and then you can change
the logging for that view by setting the threshold on DAOAppender.
That would tend to put view-specific output in different files but it
wouldn't have to be that way.

On 3/22/07, Paul Smith [EMAIL PROTECTED] wrote:

I'd like to
experiment with Domains as purely a 'view' onto a set of Loggers,
providing coarse grained operations on them.


--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Preventing re-initialization or re-configuration

2007-03-21 Thread James Stauffer

If you can pursuade the library author to make a change maybe you can
persuade them to follow the best practices for libraries which
strongly discourage explictit configuration.  There is discussion
about this in the archives.

Setting up repository selectors might be helpful.

On 3/21/07, Dave Levitt [EMAIL PROTECTED] wrote:

I was trying to find out where my logging output was going in a J2EE
application [WebSphere _and_ ATG Dynamo - things just don't get any
uglier than that]

When I enabled log4j.debug, I saw that the log4j system was being
initialized twice, once by my log4j.xml and a second time from a
log4j.properties file inside a library.

The library is explicitly calling
BasicConfigurator.resetConfiguration() ;
And then reconfiguring from its own internal copy of log4j.properties,
which does nothing useful for my debugging.

So, I'm now looking for one of two things, either:

A way to initialize the log4j system that can block later attempts to
reconfigure it

or

A simple test that I can persuade the library author to implement that
will say 'its already configured - don't do anything'. Like performing
a LogManager.getCurrentLoggers() and seeing if it contains anything.
[its a political impossibility for me to alter the library source
code].

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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 with web applets

2007-03-21 Thread James Stauffer

It loads it from the classpath so just ensure that it is in the applet
classpath.

On 3/21/07, Luciano [EMAIL PROTECTED] wrote:

Hi ! I'm testing log4j in web applets. And I'm having questions about
configuration files.

Which location (path) is used to read the configuration file on applets
? I'm thinking the file is being get from web server, is it ok ?

Well, how to setup some configuration on client without affecting web
server configuration ?

Regards.

Luciano

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Inconsistancy between logger.XXX(message) and logger.isXXXEnabled()

2007-03-16 Thread James Stauffer

I just did a test with 1.2.8 and got different results.  Please retest.

In sps.wfds.biz.glacier.JDocOptions:
   logger.info(logger.isDebugEnabled()= + logger.isDebugEnabled());

 !-- No loggers under sps.wfds defined so the following applies --
 logger name=sps
   level value=debug/
   appender-ref ref=OutputApp/
 /logger

INFO 27:56.449 sps.wfds.biz.glacier.JDocOptions   logger.isDebugEnabled()=false


On 3/16/07, James Stauffer [EMAIL PROTECTED] wrote:

The results you claim are surprising.  I don't expect it to check for
the existence of a logger but I do expect the fact that the effective
level is info would cause isDebugEnabled() to return false.

On 3/15/07, John Eisenman [EMAIL PROTECTED] wrote:
 I'm using version 1.2.14

 My expectation in using log4j was that a call to logger.isXXXEnabled()
 would return true only in the case that a call to logger.XXX(some
 message) would result in the message being written to some appender.
 However, it appears that the existence of an appender has no bearing the
 Enabled call.

 For example, I have this simple configuration:

 ?xml version=1.0 encoding=UTF-8 ?
 !DOCTYPE log4j:configuration SYSTEM log4j.dtd

 log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'

   appender name=STDOUT class=org.apache.log4j.ConsoleAppender
 param name=Threshold value=debug/
 layout class=org.apache.log4j.PatternLayout
   param name=ConversionPattern value=%-4r [%t] %-5p %c %x - %m%n/
 /layout
   /appender

   root
 level value =info/
 appender-ref ref=STDOUT/
   /root
 /log4j:configuration


 Using this configuration, and this program (based on log4j's examples):


 package chapter3;

 import org.apache.log4j.Logger;
 import org.apache.log4j.xml.DOMConfigurator;

 public class BugApp3 {
 //final static Logger logger = Logger.getLogger(BugApp3.class);
 final static Logger logger = Logger.getLogger(chapter3.BugApp3);

   public static void main(String[] args) {
 DOMConfigurator.configure(args[0]);

 logger.info(Entering application.);

 //debug is not enabled
 logger.debug(Debug is enabled.);

 if (logger.isDebugEnabled()) {
 logger.info(isDebugEnabled() returns true!);
 }

 logger.info(Exiting application.);
   }
 }

 I see the following output:

 % java chapter3.BugApp3 bug0.xml
 0[main] INFO  chapter3.BugApp3  - Entering application.
 2[main] INFO  chapter3.BugApp3  - isDebugEnabled() returns true!
 3[main] INFO  chapter3.BugApp3  - Exiting application.

 However, if I set the root level to debug instead, then I get this
 output instead:

 % java chapter3.BugApp3 bug0.xml
 1[main] INFO  chapter3.BugApp3  - Entering application.
 3[main] INFO  chapter3.BugApp3  - Exiting application.

 Since the goal of an isXXXEnabled() statement is to avoid doing
 unnecessary work in the case where it will not result in actual debug
 output, it seems unfortunate that it does not take into account the
 existence of an appender.

 Is this behavior intentional?

 -John





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




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




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: DailyRollingFileAppender help needed please

2007-03-16 Thread James Stauffer

maxLogs isn't a value of that appender in 1.2.  You may be thinking of
RollingFileAppender or 1.3.

Don't put the pattern in the File value.
  param name=File
 value=logs/LogFile.log/


On 3/16/07, Andrew Marlow [EMAIL PROTECTED] wrote:

James Stauffer wrote:
 There are no included appenders that can do that.  You could
 easily write your own appender to do that or use
 DailyRollingFileAppender to roll every hour and then have 6
 files for each watch.

ok, but ...

The name of the file that gets created contains a literal '-MM-dd-a'
rather than the actual date/time I expected. What am I doing wrong
please?
Finally, the program gives a warning at startup:
log4j:WARN No such property [maxLogs] in
org.apache.log4j.DailingRollingFileAppender.
What does this mean please? How can I make this problem go away?




 On 3/16/07, Andrew Marlow [EMAIL PROTECTED] wrote:
 Hello guys,

 I am new to log4j so please bear with me. I am writing a program in
 java that used to be written in C++. The C++ program used a
 home-grown logger. I am trying to use log4j to do the logging. The
 homegrown logger used to write 4 logfiles per day; the files were
 considered as watches of a 6 hour duration (-0600, 0600-1200,
 1200-1800 and 1800-2400). It looks to me like I might be able to
 use DailyRollingFileAppender to do a similar job.



**
The data and information (collectively called Information) herein is the sole 
property of ICAP.  The Information is confidential, may be legally privileged 
and is intended solely for the use of the individual or entity to whom it is 
addressed.  Unauthorised disclosure, copying or distribution of the Information 
is strictly prohibited and the recipient of the Information shall not 
redistribute the Information in any form to a third party.  If you received 
this Information in error please tell us by reply (or telephone the sender) and 
delete all copies on your system.

References in this Information to ICAP are references to ICAP plc, a company 
incorporated in England with registered number 3611426 whose registered office 
is 2 Broadgate, London, EC2M 7UR and where the context requires, includes its 
subsidiary and associated undertakings.  As applicable, certain companies 
within the ICAP group are authorised and regulated by the Financial Services 
Authority.  Any investment research sent from ICAP will provide an impartial 
and objective assessment of the securities, companies or other matters that are 
the subject of their research and our Conflicts of Interest Management Policy 
regarding investment research can be viewed by requesting a copy from your 
usual contact at ICAP.  Please visit www.icap.com for further regulatory 
information including details regarding the European eCommerce Directive.

***
We have taken precautions to minimise the risk of transmitting software viruses, but 
we advise you to carry out your own virus checks on any attachment to this message. 
We cannot accept liability for any loss or damage caused by software viruses. 
***


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: DailyRollingFileAppender help needed please

2007-03-16 Thread James Stauffer

That log4j output is telling you that maxLogs isn't a valid property
of DailyRollingFileAppender.

DailyRollingFileAppender only uses the date pattern when it needs to
roll.  The current file is always named exactly the value of the File
property.

From javadocs:

For example, if the File option is set to /foo/bar.log and the
DatePattern set to '.'-MM-dd, on 2001-02-16 at midnight, the
logging file /foo/bar.log will be copied to /foo/bar.log.2001-02-16
and logging for 2001-02-17 will continue in /foo/bar.log until it
rolls over the next day.


On 3/16/07, Andrew Marlow [EMAIL PROTECTED] wrote:

James Stauffer wrote:
 maxLogs isn't a value of that appender in 1.2.  You may be
 thinking of RollingFileAppender or 1.3.

The question is, what is log4j thinking of?. After all, it is log4j that says:

 log4j:WARN No such property [maxLogs] in
 org.apache.log4j.DailyRollingFileAppender.


 Don't put the pattern in the File value.
param name=File
   value=logs/LogFile.log/

Hmm. Removing the pattern certainly makes the pattern bit disappear from the 
filename. But all I am left with is literally what is in the value. So now my 
logfile is called LogFile.log! How can I get the date/time into the filename 
please? I expected it to appear in the format -MM-dd, i.e. modelled after 
the DatePattern.

BTW, I really appreciate this rapid feedback. Thanks very much!

-Andrew


 On 3/16/07, Andrew Marlow [EMAIL PROTECTED] wrote:
 James Stauffer wrote:
 There are no included appenders that can do that.  You could easily
 write your own appender to do that or use DailyRollingFileAppender
 to roll every hour and then have 6 files for each watch.

 ok, but ...

 The name of the file that gets created contains a literal
 '-MM-dd-a' rather than the actual date/time I expected. What am
 I doing wrong please? Finally, the program gives a warning at
 startup:
 log4j:WARN No such property [maxLogs] in
 org.apache.log4j.DailingRollingFileAppender.
 What does this mean please? How can I make this problem go away?

 On 3/16/07, Andrew Marlow [EMAIL PROTECTED] wrote:
 Hello guys,

 I am new to log4j so please bear with me. I am writing a program in
 java that used to be written in C++. The C++ program used a
 home-grown logger. I am trying to use log4j to do the logging. The
 homegrown logger used to write 4 logfiles per day; the files were
 considered as watches of a 6 hour duration (-0600, 0600-1200,
 1200-1800 and 1800-2400). It looks to me like I might be able to
 use DailyRollingFileAppender to do a similar job.



**
The data and information (collectively called Information) herein is the sole 
property of ICAP.  The Information is confidential, may be legally privileged 
and is intended solely for the use of the individual or entity to whom it is 
addressed.  Unauthorised disclosure, copying or distribution of the Information 
is strictly prohibited and the recipient of the Information shall not 
redistribute the Information in any form to a third party.  If you received 
this Information in error please tell us by reply (or telephone the sender) and 
delete all copies on your system.

References in this Information to ICAP are references to ICAP plc, a company 
incorporated in England with registered number 3611426 whose registered office 
is 2 Broadgate, London, EC2M 7UR and where the context requires, includes its 
subsidiary and associated undertakings.  As applicable, certain companies 
within the ICAP group are authorised and regulated by the Financial Services 
Authority.  Any investment research sent from ICAP will provide an impartial 
and objective assessment of the securities, companies or other matters that are 
the subject of their research and our Conflicts of Interest Management Policy 
regarding investment research can be viewed by requesting a copy from your 
usual contact at ICAP.  Please visit www.icap.com for further regulatory 
information including details regarding the European eCommerce Directive.

***
We have taken precautions to minimise the risk of transmitting software viruses, but 
we advise you to carry out your own virus checks on any attachment to this message. 
We cannot accept liability for any loss or damage caused by software viruses. 
***


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: named logger .

2007-03-07 Thread James Stauffer

private static Log logger = LogFactory.getLog(MyClass.class);

That will produce a logger named after the fully qualified name of the
class (i.e. com.acme.project.MyClass)


private static Log logger = LogFactory.getLog(MY_LOGGER_NAME);

That will produce a logger named exactly MY_LOGGER_NAME


and how to specify the same in the log4J.xml file.

Examples:
 logger name=com.acme.project.MyClass
 logger name=MY_LOGGER_NAME


On 3/7/07, Asif Mekrani [EMAIL PROTECTED] wrote:

Hi Group,

Please can you tell me how to use the names logger. means :

Usually we use a class name for the logger name, eg:

private static Log logger = LogFactory.getLog(MyClass.class);

but wat if, I want to use a string name instead of the class name , i.e.

private static Log logger = LogFactory.getLog(MY_LOGGER_NAME);

and how to specify the same in the log4J.xml file.

TIA.

Smiles,
Asif




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Appender - number of lines

2007-03-07 Thread James Stauffer

You could have your indexing class keep two static variables with the
times of the last full and partial index.

On 3/7/07, DECAFFMEYER MATHIEU [EMAIL PROTECTED] wrote:





Hi,

My application allows to index a web application,
and I want to show on a jsp the last time the specified web applciation has
been indexed,
like :
8 March 12 PM 32 - Full index
7 March 15 PM 46 - Partial index
etc.

So I need to get the X first lines I store.

I don't know if it is a good idea to use log4j for this,
Unfortunately there is no appender that roll the file after X lines.

Thank u for any suggestions.


__
   Matt

 
 Internet communications are not secure and therefore Fortis Banque
Luxembourg S.A. does not accept legal responsibility for the contents of
this message. The information contained in this e-mail is confidential and
may be legally privileged. It is intended solely for the addressee. If you
are not the intended recipient, any disclosure, copying, distribution or any
action taken or omitted to be taken in reliance on it, is prohibited and may
be unlawful. Nothing in the message is capable or intended to create any
legally binding obligations on either party and it is not intended to
provide legal advice.
 

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




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Appender - number of lines

2007-03-07 Thread James Stauffer

The only ideas I have for looking in the logs is to call out to grep.

On 3/7/07, DECAFFMEYER MATHIEU [EMAIL PROTECTED] wrote:

Ok, I need a list of the last indexed times but that way a List is also
possible.
But if application shuts down I lose the information ...
Well if there is no simple way, I'll just keep the information in memory
like u suggested,
Thank u
__
   Matt



-Original Message-
From: James Stauffer [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 07, 2007 5:30 PM
To: Log4J Users List
Subject: Re: Appender - number of lines

*  This message comes from the Internet Network *

You could have your indexing class keep two static variables with the
times of the last full and partial index.

On 3/7/07, DECAFFMEYER MATHIEU [EMAIL PROTECTED] wrote:




 Hi,

 My application allows to index a web application,
 and I want to show on a jsp the last time the specified web
applciation has
 been indexed,
 like :
 8 March 12 PM 32 - Full index
 7 March 15 PM 46 - Partial index
 etc.

 So I need to get the X first lines I store.

 I don't know if it is a good idea to use log4j for this,
 Unfortunately there is no appender that roll the file after X lines.

 Thank u for any suggestions.


 __
Matt

  
  Internet communications are not secure and therefore Fortis Banque
 Luxembourg S.A. does not accept legal responsibility for the contents
of
 this message. The information contained in this e-mail is confidential
and
 may be legally privileged. It is intended solely for the addressee. If
you
 are not the intended recipient, any disclosure, copying, distribution
or any
 action taken or omitted to be taken in reliance on it, is prohibited
and may
 be unlawful. Nothing in the message is capable or intended to create
any
 legally binding obligations on either party and it is not intended to
 provide legal advice.
  

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



--
James Staufferhttp://www.geocities.com/stauffer_james/
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]




Internet communications are not secure and therefore Fortis Banque Luxembourg 
S.A. does not accept legal responsibility for the contents of this message. The 
information contained in this e-mail is confidential and may be legally 
privileged. It is intended solely for the addressee. If you are not the 
intended recipient, any disclosure, copying, distribution or any action taken 
or omitted to be taken in reliance on it, is prohibited and may be unlawful. 
Nothing in the message is capable or intended to create any legally binding 
obligations on either party and it is not intended to provide legal advice.



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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: usage of log4j api

2007-03-06 Thread James Stauffer

activateOptions()

On 3/6/07, erdem boz [EMAIL PROTECTED] wrote:

Thanks for quick reply.
Do you have any example code?

On 3/5/07, James Stauffer [EMAIL PROTECTED] wrote:

 There might be a call needed to initialize the appender.

 On 3/5/07, erdem boz [EMAIL PROTECTED] wrote:
  Hello everyone ;
 
  I am trying to configure my appenders via log4j api. Besides, I want to
  change behavior of logger during runtime.
  But I got following warning when I run my code.
 
  log4j:ERROR No output stream or file set for the appender named
 [logFile].
  log4j:ERROR No output stream or file set for the appender named
 [logFile].
  log4j:ERROR No output stream or file set for the appender named
 [errorFile].
 
 
 
  What is wrong? Can anybody tell me?
 
  class Log {
 
  private static Logger logger = null;
  private static PatternLayout layout = null;
 
  public static Logger getLogger() {
  if(logger == null){
  logger = Logger.getLogger(DispLogger);
  BasicConfigurator.configure();
  logger.addAppender(getLogAppender());
  logger.addAppender(getErrorAppender());
  }
  return logger;
  }
 
 
  private static Appender getLogAppender(){
  RollingFileAppender appder = new RollingFileAppender();
  appder.setName(logFile);
  appder.setFile(log + File.separator + dispatcherLog.txt);
  appder.setThreshold(Level.DEBUG);
  appder.setMaxFileSize(1MB);
  appder.setMaxBackupIndex(5);
  appder.setAppend(true);
  appder.setLayout(getLayout());
  return appder;
  }
 
  private static Appender getErrorAppender(){
  RollingFileAppender appder = new RollingFileAppender();
  appder.setName(errorFile);
  appder.setFile(log + File.separator + dispatcherError.txt);
  appder.setThreshold(Level.ERROR);
  appder.setMaxFileSize(1MB);
  appder.setMaxBackupIndex(5);
  appder.setAppend(true);
  appder.setLayout(getLayout());
  return appder;
  }
 
  private static Appender getConsoleAppender(){
  ConsoleAppender appder = new ConsoleAppender();
  appder.setName(console);
  appder.setThreshold(Level.DEBUG);
  appder.setTarget(System.out);
  appder.setLayout(getLayout());
  return appder;
  }
 
  }
 


 --
 James Staufferhttp://www.geocities.com/stauffer_james/
 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 Staufferhttp://www.geocities.com/stauffer_james/
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 MDC

2007-03-06 Thread James Stauffer

According to the javadocs there isn't a way to print everything.  You
must list every key.

On 3/6/07, Asif Mekrani [EMAIL PROTECTED] wrote:

Hi All,

How can i print all the parameter in the MDC. I try some thing like this in
my log4J file:

%X{parameterKey} and this gets print. but, when i want to print more than
one parameter how should it. can some body tell me the syntax.

Thanks in advance.

Smiles,
Asif




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: maxBackupIndex with DailyRollingFileAppender

2007-03-01 Thread James Stauffer

In 1.2 no, but I think that is supported in 1.3.  In 1.2 you could set
up a cron job to delete the extra files.

On 3/1/07, DM [EMAIL PROTECTED] wrote:

Hi,

When using a DailyRollingFileAppender, is there any way to specify the maximum 
number of files which should be kept? I know that the RollingFileAppender 
supports a maxBackupIndex property, but it seems this is not supported by 
DailyRollingFileAppender. I don't want to use RollingFileAppender because I 
want the files to rollover every day, rather than when they reach a certain 
size. So my requirements are:

- Roll files over daily
- Only keep the last 5 log files

Thanks in Advance,
DM



___
Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. 
http://uk.docs.yahoo.com/nowyoucan.html

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: maxBackupIndex with DailyRollingFileAppender

2007-03-01 Thread James Stauffer

1.2 generally only gets bug fixes so it is highly unlikely that it
would get that feature added.

On 3/1/07, DM [EMAIL PROTECTED] wrote:

Thanks for the response. I guess I'll have to wait for 1.3 then. The following 
page on the wiki:
http://wiki.apache.org/logging-log4j/DailyRollingFileAppender

indicates that somebody has extended DailyRolloingFileAppender to include this 
feature, but I'm not sure if this has been included in an official release?



--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Multiple logging files

2007-02-28 Thread James Stauffer

3. Both the system property and any needed directories need to be set
before log4j is configured.  I created an appender that can create
directories as needed and it is at
http://stauffer.james.googlepages.com/DateFormatFileAppender.java

4. In your code you don't refer to a special appender, you refer to
special loggers.
i.e
Logger logger = Logger.getLogger(getClass().getName());
Logger specialLogger = Logger.getLogger(special. + getClass().getName());

 logger name=special
   level value=info/
   appender-ref ref=specialAppender /
 /logger

 root
   priority value =info /
   appender-ref ref=mainAppender /
   appender-ref ref=consoleAppender /
 /root

On 2/28/07, DECAFFMEYER MATHIEU [EMAIL PROTECTED] wrote:

For the System property issue I tried this :

  appender name=specialAppender
class=org.apache.log4j.DailyRollingFileAppender
  param name=DatePattern value='.'-MM-dd-HH/
  param name=File
value=C:/UserTemp/matthew016/${log.name}/
  layout class=org.apache.log4j.PatternLayout
   param name=ConversionPattern value=%d{ISO8601} %-5p
[%-30.30c{2}] %m%n/
  /layout
  /appender

And in my Java applciation I execute this line before I need to log in
the special appender :

System.setProperty(log.name,idRequest+.log);

[2/28/07 12:16:32:297 CET] 3e89f5a2 SystemErr R log4j:ERROR
setFile(null,true) call failed.
[2/28/07 12:16:32:297 CET] 3e89f5a2 SystemErr R
java.io.FileNotFoundException: C:\UserTemp\matthew016 (Access is denied)

Though something like this param name=File
value=C:/UserTemp/matthew016/myLog.log/ works.

I tried also a simple thing :
If I do this :
param name=File value=C:/UserTemp/matthew016/updates/myLog.log/

[2/28/07 12:15:17:669 CET] 3e8d3584 SystemErr R log4j:ERROR
setFile(null,true) call failed.
[2/28/07 12:15:17:669 CET] 3e8d3584 SystemErr R
java.io.FileNotFoundException: C:\UserTemp\matthew016\updates\test.log
(The system cannot find the path specified)

It gives me the same error, because it cannot find the directory
updates under dir matthew016.
Though I create this dir dynamically in my application *before* any logs
need to be stored trhough the appender specified output.

__
   Matt



-Original Message-
From: DECAFFMEYER MATHIEU [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 28, 2007 9:58 AM
To: Log4J Users List
Subject: RE: Multiple logging files

*  This message comes from the Internet Network *

Yes exactly  :-) Thank u very much,
I realized I did this all wrong.

I have read the Log4J tutorial,

I did the points 1  2, but for I have some difficulties on how to
implement point 3  4

I switched this to XML :

  appender name=mainAppender
class=org.apache.log4j.FileAppender
   param name=DatePattern value='.'-MM-dd-HH/
   param name=File value=C:/UserTemp/matthew016/app.log/
   layout class=org.apache.log4j.PatternLayout
   param name=ConversionPattern value=%d{ISO8601} %-5p
[%-30.30c{2}] %m%n/
   /layout
  /appender
  appender name=specialAppender
class=org.apache.log4j.FileAppender
  param name=DatePattern value='.'-MM-dd-HH/
  param name=File value=C:/UserTemp/matthew016/  SYSTEM
PROPERTY /
  param name=File value=C:/UserTemp/matthew016/app.log/
  layout class=org.apache.log4j.PatternLayout
   param name=ConversionPattern value=%d{ISO8601} %-5p
[%-30.30c{2}] %m%n/
  /layout
  /appender
  appender name=consoleAppender
class=org.apache.log4j.ConsoleAppender
  layout class=org.apache.log4j.PatternLayout
   param name=ConversionPattern value=%-5p %c{1} - %m%n
/
  /layout
  /appender
  root
priority value =info /
appender-ref ref=mainAppender /
appender-ref ref=specialAppender /
appender-ref ref=consoleAppender /
  /root


*  In my Java class I don't know how I can specify which appender I
should use,
   Or maybe I can specify the logger in the log4j.xml file ?

*  I don't knwo how to use the system property,
   In the program I suppose I just need to do something like this :
System.setProperty(myProp,updates/+dirNumber);
   But what do I need to specify in the XML file ?

*  Is it correct what I did in the special appender ? I specified the
file which must include the system property and the same file as the
main appender,
   is this the good way.


Thank u for any hints!

__
   Matt



-Original Message-
From: James Stauffer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 27, 2007 5:47 PM
To: Log4J Users List
Subject: Re: Multiple logging files

*  This message comes from the Internet Network *

This should do what you want:
1. Switch to XML config.
2. Define your main appender and special appender
3. Use a system property for the name of the file in the special
appender.
4

Re: Root logger appenders in log4j 1.3

2007-02-28 Thread James Stauffer

You can use code to remove all appenders.

On 2/28/07, Sergiu Bivol [EMAIL PROTECTED] wrote:

Anyone? Please advice on the configuration scenario in the previous message.


In short, we'd like to log messages in a certain way (specified in a
log4j.xml internal to our jar) when our app boots, and then at normal
runtime log messages as configured by the user in an external log4j.xml.

At this point, we can't find a way to override boot-time log4j configuration
with log4j 1.3.

Thank you

-Original Message-
From: Sergiu Bivol [mailto:[EMAIL PROTECTED]
Sent: February 23, 2007 3:20 PM
To: 'Log4J Users List'
Subject: RE: Root logger appenders in log4j 1.3

Hi,

Yes, perhaps there are reasons to change it, but then help me understand how
to configure log4j in the following scenario.

We provide a log4.xml within our app's jar so that our application logs
messages during startup (say to file1 and console). We also let the users
specify a separate (external to our jars) log4j xml file to configure how
the app should log messages after the startup phase (say file2 and console).

With 1.2, this could be done by attaching the corresponding 2 appenders to
the root element in each of the config files. How would I achieve the same
behavior in 1.3? At this point, both file1 and file2 are growing, and every
message is showing twice on the console.

Thank you
Sergiu

-Original Message-
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
Sent: February 23, 2007 2:49 PM
To: Log4J Users List; Log4J Users List
Subject: Re: Root logger appenders in log4j 1.3


Hello Jake et al,

The complete log4j manual is correct as far as log4j 1.0, 1.1, 1.2 are
concerned. However, in log4j 1.3 the behavior was changed because:

1) it is not what a user would expect without reading the docs (surprise
element)
2) very few people seemed to take advantage of the pre 1.3 behaviour**

** The pre 1.3 behavior was intended to support partial config files

The different behaviors should be transparent to the user as long as she
does not do partial configs.

I hope this helps,

At 06:15 AM 2/23/2007, Jacob Kjome wrote:

That's an interesting quote.  I have to admit that I haven't read the
Log4j manual and that's new to me.  In Log4j, reconfigurations are
genrally not destructive.  They are cumulative.  It sounds like the manual
is claiming that the ROOT logger is an exception to the rule.

Have you tried this with Log4j-1.2.xx?  Do you get the same results or do
you get the behavior described in the manual?  It's certainly possible
that this contract was broken in 1.3.

Ceki, Curt, anyone, can you shed any light on this topic?  What's the
expected behavior?  Is the manual right, wrong, or just being
misinterpreted?


Jake

--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for
Java.
http://logback.qos.ch


-
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 Staufferhttp://www.geocities.com/stauffer_james/
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: Using XMLLayout..

2007-02-28 Thread James Stauffer

Since the file is continuously changed it wouldn't be possible to have
a root element unless it is added as it is rolled.

On 2/28/07, Madduri, Murthy [EMAIL PROTECTED] wrote:

Hi,



As a part of our J2EE application, we need to build a custom Layout for
the logging event. The generated log file is expected to be very large.

The custom layout need not to conform to any DTD, but, needs to be a
well-formed XML with the root element.

I am using XPath expression on the XML string to get the proper output.



Right now, I have extended the Layout class to generate the output using
brute StringBuffer append method.

When I am trying to transform this file (which is not a well-formed
XML), the transformer complains that it is missing the root element.

Is it a better idea to tweak the XMLLayout to fit-in the custom content?



Here is a sample of the content that is in the log file:

MSGHOSTmyHost/HostSTATUSResponse/STATUS/MSG

MSGHOSTmyHost1/HostSTATUSFAIL/STATUS/MSG

MSGHOSTmyHost2/HostSTATUSUnknown/STATUS/MSG



If I can get this with a root element, the transformer works fine.



ROOT

MSGHOSTmyHost/HostSTATUSResponse/STATUS/MSG

MSGHOSTmyHost1/HostSTATUSFAIL/STATUS/MSG

MSGHOSTmyHost2/HostSTATUSUnknown/STATUS/MSG

/ROOT



I appreciate any help on this.



Thanks  Regards,

Murthy Madduri

*(770)263-1231

*Email:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]









--
James Staufferhttp://www.geocities.com/stauffer_james/
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: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)

2007-02-27 Thread James Stauffer

Are you calling jc.doConfigure multiple times?  It should only be
called once during the program run.

On 2/27/07, Surya Poola [EMAIL PROTECTED] wrote:

Hi,

  When Iam using joran configurator in log4j1.3 alpha 8 version, log is written 
in folds into log file.ie, first call of execution of my program writes the 
text once, for second call it writes twice and the logging is growing 
exponentially for subsequent calls.

  my code looks like:
  JoranConfigurator jc = new JoranConfigurator();
jc.doConfigure(C:\jakarta-tomcat-4.1.30\webapps\log4j.xml,LogManager.getLoggerRepository())
  logger.info(test log );

  I tried using the deprecated DOMConfigurator also, but this also behaves the 
same ,because DOMConfigurator is extended from JoranConfigurator.

  But when i keep the log4j.xml file in classes folder of web application and 
not specifying any configurator then the logging is happening perfectly.So i 
hope the problem is using JoranConfigurator.


--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Display log4j.xml on jsp

2007-02-27 Thread James Stauffer

You could write a custom appender to grab the logs and then have your
JSP grab them from that appender.

On 2/27/07, sunil nagavaram [EMAIL PROTECTED] wrote:

Guys,
Did anyone try this, displaying logs generated by log4j on jsp. If so can
you please write down the steps for me

Thank you
--
Sunil




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Multiple logging files

2007-02-27 Thread James Stauffer

This should do what you want:
1. Switch to XML config.
2. Define your main appender and special appender
3. Use a system property for the name of the file in the special appender.
4. Make sure you have your loggers setup so logs from the special part
of your code go to the special appender.

On 2/27/07, DECAFFMEYER MATHIEU [EMAIL PROTECTED] wrote:

Thanks for your response,
it's not exactly what I want actually :

I have a main log where every log is stored,
But in a part of my code I want to log in a separate file (and still in
the main log file),
the location in which I must store the logs of this block of code
is told dynamically in my application in a new Log4j file
(log4j.appender.file.File=).

So in other words each time I execute this block of code I create a new
Log4J file because I must specify a new directory where to store the
logs.
(e.g. first time I execute the specific block of code store log in
directory 21456, second time in 14598, ...)

So at the start of this code I do :
PropertyConfigurator.configure(...);
To load dynamically a new Log4J file (where the new location in which I
store the logs is specified)

But when I execute this, the logs aren't stored anymore in the main log
file.
I tried :
ApplicationLogManager.info(test1);
PropertyConfigurator.configure(logConfigFileName);
ApplicationLogManager.info(test2);
The main log file displays test1 but nothing anymore below it.
That is problem #1.

Then when this block of code is exectued, I want to load again the main
Log4j file, in the classpath but I don't know how to load this one
PropertyConfigurator.configure(??);


Maybe I'm doing this all wrong :-) (   :(   )

__
   Matt



-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Monday, February 26, 2007 8:55 PM
To: Log4J Users List
Subject: Re: Multiple logging files

*  This message comes from the Internet Network *


Loggers inherit appenders unless they are told not to.  If you add an
appender
to a logger and you want all logging for that logger to go only to the
appender
you just added to it, you'll have to set additivity=false to this
logger.

log4j.additivity.com.mycompany.MyClass=false
OR
logger name=com.mycompany.MyClass additivity=false

/logger


Jake

Quoting DECAFFMEYER MATHIEU [EMAIL PROTECTED]:


 Hi,

 I have a main log file where all the logs are stored of the
application.
 But I have a block of instructions in my application and I want the
logs
 of this code to be stored in another log file.

 So I execute this :

 PropertyConfigurator.configure(...);

 It works ok, but the logs are now stored in both file :
 the file I specified in the configure method above
 the main log file

 Can anyone help ?

 Thank u.
 __

Matt



 
 Internet communications are not secure and therefore Fortis Banque
Luxembourg
 S.A. does not accept legal responsibility for the contents of this
message.
 The information contained in this e-mail is confidential and may be
legally
 privileged. It is intended solely for the addressee. If you are not
the
 intended recipient, any disclosure, copying, distribution or any
action taken
 or omitted to be taken in reliance on it, is prohibited and may be
unlawful.
 Nothing in the message is capable or intended to create any legally
binding
 obligations on either party and it is not intended to provide legal
advice.
 






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




Internet communications are not secure and therefore Fortis Banque Luxembourg 
S.A. does not accept legal responsibility for the contents of this message. The 
information contained in this e-mail is confidential and may be legally 
privileged. It is intended solely for the addressee. If you are not the 
intended recipient, any disclosure, copying, distribution or any action taken 
or omitted to be taken in reliance on it, is prohibited and may be unlawful. 
Nothing in the message is capable or intended to create any legally binding 
obligations on either party and it is not intended to provide legal advice.



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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)

2007-02-27 Thread James Stauffer

If you are calling doConfigure in doGet of each servlet then it is
being configured multiple times -- once for each request processed.
The easiest way to configure it only once is to put the config file in
the classpath and allow it to be automatically configured.  An
alternative is to call doconfigure in static code that is only called
once.

On 2/27/07, Surya Poola [EMAIL PROTECTED] wrote:

Iam sure the code is only executed once, why because without specifying any 
configurator and placing log4j.xml in classes folder of the web application, 
everything works fine.But when i specify configurator and remove the log4j.xml 
from classes folder and place log4j.xml in different location and refer the 
log4j.xml by configurator then iam facing this problem.

Iam running my program through tomcat,and calling my program in doget() method 
of servlets like:
logger=Logger.getLogger(this.getClass().getName());
JoranConfigurator jc = new JoranConfigurator();
 
jc.doConfigure(C:\jakarta-tomcat-4.1.30\webapps\log4j.xml,LogManager.getLoggerRepository())
 logger.info(test log );

Regards
Rohan

James Stauffer [EMAIL PROTECTED] wrote: Are you sure that code is only 
executed once per program run?  Are you
running in Tomcat, and where are you calling doConfigure?

On 2/27/07, Surya Poola  wrote:
 Iam calling jc.doconfigure only once in my program.I hope this should not be 
the
   problem.


 James Stauffer  wrote:
   Are you calling jc.doConfigure multiple times? It should only be
 called once during the program run.

 On 2/27/07, Surya Poola wrote:
  Hi,
 
  When Iam using joran configurator in log4j1.3 alpha 8 version, log is 
written in folds into log file.ie, first call of execution of my program writes the 
text once, for second call it writes twice and the logging is growing exponentially 
for subsequent calls.
 
  my code looks like:
  JoranConfigurator jc = new JoranConfigurator();
  
jc.doConfigure(C:\jakarta-tomcat-4.1.30\webapps\log4j.xml,LogManager.getLoggerRepository())
  logger.info(test log );
 
  I tried using the deprecated DOMConfigurator also, but this also behaves 
the same ,because DOMConfigurator is extended from JoranConfigurator.
 
  But when i keep the log4j.xml file in classes folder of web application and 
not specifying any configurator then the logging is happening perfectly.So i hope the 
problem is using JoranConfigurator.

 --
 James Stauffer http://www.geocities.com/stauffer_james/
 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]




 -
 No need to miss a message. Get email on-the-go
 with Yahoo! Mail for Mobile. Get started.


--
James Staufferhttp://www.geocities.com/stauffer_james/
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]




-
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.

-
Access over 1 million songs - Yahoo! Music Unlimited.



--
James Staufferhttp://www.geocities.com/stauffer_james/
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: tutorial about log4j

2007-02-26 Thread James Stauffer

Please add it to the wiki.
http://wiki.apache.org/logging-log4j/Log4JProjectPages

On 2/26/07, Sebastian Hennebrueder [EMAIL PROTECTED] wrote:

Hello,
I just finished a tutorial using the current log4j version and would
like to invite you to add the tutorial to your list. It provides basic
examples, compares property and xml configuration, gives detailled
pointers to the API documentation, some infos on best practices and an
example on how to change configuration dynamically in Tomcat application
server.

http://www.laliluna.de/log4j-tutorial.html

-- Best Regards / Viele Grüße

Sebastian Hennebrueder


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Class for sending STDERR to log4j

2007-02-23 Thread James Stauffer
[count] = (byte) b;

   count++;
 }


 /**
  * Flushes this output stream and forces any buffered output bytes
  * to be written out. The general contract of codeflush/code is
  * that calling it is an indication that, if any bytes previously
  * written have been buffered by the implementation of the output
  * stream, such bytes should immediately be written to their
  * intended destination.
  */
 public void flush() {

if (count == 0) {

 return;
   }

// don't print out blank lines; flushing from PrintStream puts

   // out these

// For linux system
/*
   if (count == 1  ((char) buf[0]) == '\n') {
 reset();
 return;
   }

// For mac system

   if (count == 1  ((char) buf[0]) == '\r') {
 reset();
 return;
   }
*/
// On windows system

   if (count==2  (char)buf[0]=='\r'  (char)buf[1]=='\n') {
 reset();
 return;
   }

final byte[] theBytes = new byte[count]; System.arraycopy(buf, 0, theBytes, 0,
count); logger.log(level, new String(theBytes)); reset();

 }


 private void reset() {
   // not resetting the buffer -- assuming that if it grew then it
   //   will likely grow similarly again
   count = 0;
 }

}

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Changing / Retrieving log4j config at runtime

2007-02-16 Thread James Stauffer

Look for LogWeb it is a servlet that allows configuring log4j.  It
will either meet your needs or show you how to do what you want to do.

On 2/16/07, Gaurav Arora [EMAIL PROTECTED] wrote:

Hi,
I have been trying to retrieve all loggers attached to a root log
using a servlet that runs at server startup but I haven't been able to
do so yet. I tried using the getAllAppenders method, which the manual
says is deprecated and the Hierarchy class as well, both don't seem to
work. What I am trying to do is, get a list of all loggers and appenders
attached to them on server startup and dump them in a more user friendly
view. Have I been doing it the wrong way? Is there a better way to do
the above?

I'm using version 1.2.14 and Tomcat 5.5.

Thanks,
Gaurav


Disclaimer :- This e-mail message including any attachment may contain 
confidential, proprietary or legally privileged information. It should not be 
used by who is not the original intended recipient. If you have erroneously 
received this message, you are notified that you are strictly prohibited from 
using, copying, altering or disclosing the content of this message. Please 
delete it immediately and notify the sender. Newgen Software Technologies Ltd 
and / or its subsidiary Companies accept no responsibility for loss or damage 
arising from the use of the information transmitted by this email including 
damage from virus and further acknowledges that any views expressed in this 
message are those of the individual sender and no binding nature of the message 
shall be implied or assumed unless the sender does so expressly with due 
authority of Newgen Software Technologies Ltd and / or its subsidiary 
Companies, as applicable.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Changing / Retrieving log4j config at runtime

2007-02-16 Thread James Stauffer

I don't know if this would work but you could try recursing the logger
tree removing all appenders and reseting all levels before calling
configure.

On 2/16/07, zeusfaber [EMAIL PROTECTED] wrote:




James Stauffer wrote:

 For one thing, DOMConfigurator.configure adds to the current config --
 it doesn't replace it.  Thay is why some loggers still see the changed
 configuration.


Thank you James for you prompt reply.
Hummm,
this could be the reason I'm seeing strange behaviours.
But so, what would be the correct procedure to reload programmatically the
old configuration without restarting the application?
I found no evidence in the complete manual too :-)

bye

--
Davide
--
View this message in context: 
http://www.nabble.com/Changing---Retrieving-log4j-config-at-runtime-tf3238396.html#a9007011
Sent from the Log4j - Users mailing list archive at Nabble.com.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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 xml configuration

2007-02-14 Thread James Stauffer

 logger name=my.package
   level value=debug/
 /logger


On 2/14/07, Drinkwater, GJ (Glen) [EMAIL PROTECTED] wrote:

Hi

I am currently moving all our log4j.properties files to XML files and
was wondering how I replicate this with the xml configuration.

In the properties file, I can put in

log4j.logger.my.package=DEBUG

Which means only logs from 'my.package' with level DEBUG or above gets
logged and anything outside these package does not.

How do I do this with an XML configuration.

Thanks Glen




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Help with DailyRollingFileAppender

2007-02-02 Thread James Stauffer

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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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='.'-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
 
  param name=File value=${catalina.home}/logs/olb.log/
  param name=DatePattern value='.'-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=EPAY class=
 org.apache.log4j.DailyRollingFileAppender
 
  param name=File value=${catalina.home}/logs/epay.log/
  param name=DatePattern value='.'-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=MBR class=
 org.apache.log4j.DailyRollingFileAppender
 
  param name=File value=${catalina.home
  }/logs/memberservices.log/
  param name=DatePattern value='.'-MM-dd/
  layout class=org.apache.log4j.PatternLayout
   param name=ConversionPattern value=%d{HH:mm:ss,SSS}
 [%t]
  %-5p %c - %m%n/
  /layout
  /appender
 
  category name=com.purdueefcu.epay
  priority value=ERROR/
  appender-ref ref=EPAY/
  /category
 
 
  category name=com.purdueefcu.onlinebanking
  priority value=ERROR/
  appender-ref ref=OLB/
  /category
  category name=com.purdueefcu.memberservices
  priority value=ERROR/
  appender-ref ref=MBR/
  /category
 
 
  root
  priority value=ERROR/
  appender-ref ref=TOMCAT/
  /root
  /log4j:configuration
 
 


 --
 James Staufferhttp://www.geocities.com/stauffer_james/
 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 Staufferhttp://www.geocities.com/stauffer_james/
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: What is the best way

2007-02-01 Thread James Stauffer

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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Help with DailyRollingFileAppender

2007-02-01 Thread James Stauffer

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 [EMAIL PROTECTED] 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='.'-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

param name=File value=${catalina.home}/logs/olb.log/
param name=DatePattern value='.'-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=EPAY class=org.apache.log4j.DailyRollingFileAppender

param name=File value=${catalina.home}/logs/epay.log/
param name=DatePattern value='.'-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=MBR class=org.apache.log4j.DailyRollingFileAppender

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

category name=com.purdueefcu.epay
priority value=ERROR/
appender-ref ref=EPAY/
/category


category name=com.purdueefcu.onlinebanking
priority value=ERROR/
appender-ref ref=OLB/
/category
category name=com.purdueefcu.memberservices
priority value=ERROR/
appender-ref ref=MBR/
/category


root
priority value=ERROR/
appender-ref ref=TOMCAT/
/root
/log4j:configuration





--
James Staufferhttp://www.geocities.com/stauffer_james/
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 based API baseline performance

2007-01-30 Thread James Stauffer

There is a section on performance at the bottom of
http://logging.apache.org/log4j/docs/manual.html

On 1/30/07, Kamal Ahmed [EMAIL PROTECTED] wrote:

Hi,

I am trying to establish a baseline performance for a log4j API based
logging Application.
Any hints/ideas/url's would be appreciated.

Thanks,
-Kamal.

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Using Log4J

2007-01-27 Thread James Stauffer

I would suggest read http://logging.apache.org/log4j/docs/manual.html

On 1/27/07, Padmanaban Varatharajan [EMAIL PROTECTED] wrote:


Hi

I'm not clear. Do you mean to say, I'm overriding the previous
properties? In case, if I use Logger.getRootLogger(), what will be the
scenario? Will it be printing the log details in both the files? And how
about for the consoleAppender? I have 2 console appenders, one with
INFO and another with Error (New).

The previous two appenders are part of the rootCategory. Can I add these
two (new) in the same? Or a new category?

log4j.category.CategoryName=INFO, NEWFILE, NEWCONSOLE

 If a new category, how to access the same in code? Is that like I
mentioned earlier Category.getInstance(CategoryName)?

As I said already, I'm new to this. Please I need little more
explanation/code sample. Hope, I'm not hurting you.

We can even talk... [EMAIL PROTECTED] as I need this badly and
quickly...

Thanks again
padmanaban


-Original Message-
From: James Stauffer [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 27, 2007 10:17 PM
To: Padmanaban Varatharajan
Subject: Re: Using Log4J

You don't have to do anything special.  Your current Logger statement
should work fine because you are attaching the new appenders to the
same logger.

On 1/27/07, Padmanaban Varatharajan [EMAIL PROTECTED]
wrote:




 Hi James



   First of all, thanks for your response. I'm almost certain with
the
 properties file. But I guess that, I'm missing something in my java
code. As
 I'm new to this I need a little more info on this.



 Do I need to use something like this?



   Category.getInstance(NEWFILE) and
Category.getInstance(NEWCONSOLE)



 Or Logger.getLogger(NEWFILE) and Logger.getLogger(NEWCONSOLE)



 Please help me out with sample java code to access the new categories
I
 define in log4j.properties.



 Thanks Again.



 Thanks  Regards

 Padmanaban




 -Original Message-
  From: James Stauffer [mailto:[EMAIL PROTECTED]
  Sent: Thursday, January 25, 2007 8:51 PM
  To: Log4J Users List
  Subject: Re: Using Log4J



 There should be no problems doing that.  You will just want to set the

 Threshold to ERROR on NEWCONSOLE.



 On 1/25/07, Padmanaban Varatharajan
 [EMAIL PROTECTED] wrote:

 

  Hi All,

 

 

 

  In Log4J, I have to use the same properties file (log4j.properties)
in

  which I have certain configuration details already defined with the

  following:

 

 

 

  Existing: log4j.rootcategory=INFO, CONSOLE, LOGFILE

 

 

 

  *  Default logging level is INFO and two appenders.

 

  *  One is ConsoleAppender and the other is FileAppender.

 

  *  And the threshold level is INFO for both the appenders

 

 

 

  And my Requirement is

 

  *  I need to use another appender, which will be

  RollingFileAppender

 

  *  The threshold level is INFO

 

  *  Need to write the logging details in a different file.

 

 

 

  Also

 

  *  I would like to use another consoleAppender with the
logging

  level as ERROR. As the existing one is having INFO level.

 

 

 

  Say: log4j.rootcategory=INFO, CONSOLE, LOGFILE, NEWFILE, NEWCONSOLE

 

 

 

  Can anyone help me to achieve this? Also, tell me how to use the
same in

  the java code? Sample code will do better and appreciable.

 

 

 

  Please respond me ASAP.

 

 

 

  Thanks

 

  Padmanaban

 

 

 

  This message and the information contained herein is proprietary and
 confidential and subject to the Amdocs policy statement,

  you may review at
 http://www.amdocs.com/email_disclaimer.asp

 





 --

 James Stauffer
 http://www.geocities.com/stauffer_james/

 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 Staufferhttp://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

This message and the information contained herein is proprietary and 
confidential and subject to the Amdocs policy statement,
you may review at http://www.amdocs.com/email_disclaimer.asp




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Log file will not append

2007-01-26 Thread James Stauffer

Run with -Dlog4j.debug in the command line and look in the system output.

On 1/26/07, Melvin Mah [EMAIL PROTECTED] wrote:

I have a program in which it uses the log4j to produce its logs. Recently,
as of last month, it worked fine. But when I tried testing a program, the
log, which I specified its destination path to be shown did not append. The
settings are as follows:



log4j.rootCategory=DEBUG, UNCATEGORIZED

log4j.appender.UNCATEGORIZED=org.apache.log4j.RollingFileAppender

log4j.appender.UNCATEGORIZED.MaxFileSize=100MB

log4j.appender.UNCATEGORIZED.MaxBackupIndex=4

log4j.appender.UNCATEGORIZED.File=C:/elmu-esam.log

log4j.appender.UNCATEGORIZED.layout=org.apache.log4j.PatternLayout

log4j.appender.UNCATEGORIZED.layout.ConversionPattern=%d %-5p [%t] %c{1}:
%m%n



This was unchanged  - I still retain the settings. But when checking back
the log file, I only find that the last update to the file was on 13th
December.

The file is still read-write enable (the read-only option is turned off). I
also experimented on specifying a different location but the new file did
not appear at all.



Pls help!








--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Changing loglevel at runtime (systemwide)

2007-01-25 Thread James Stauffer

Would it work to have two output files(or sets of files) -- one at
normal level and one at debug level?  Then if you don't need the debug
output just delete the debug logs.

On 1/25/07, Detering Dirk [EMAIL PROTECTED] wrote:

Hello all,

I subscribed to this list to get some help regarding
a problem with conditional level switching we encountered
in our development team.

Let me first explain what we do and why.

Background:

Application:  A code generator, doing two steps:
Model validation and code generation for each class in
the model (more or less). The generator is developed in
our team but used in many other application development
teams.

Problem:
The validation may be incomplete, causing the generator
to throw runtime exceptions at unexpected locations during
the generation step.
In this case, the stack trace isn't very helpful, as it
documents somehow _where_ the problem occurred, but not
clearly _why_  (means: which model element caused the
problem). This is partly due to Velocity.

Current solution:
The time consuming solution is to reconfigure the log settings to
get DEBUG infos from different generator classes during runtime,
and restart the whole generation.

   Drawback:
   * A generator developer has to be involved to analyse
 the stack and do the right debug configurations
   * The complete generator run has to be repeated
   * When switching a Logger to DEBUG, it _always_
 logs what it does, not only for the problematic part/element
 of the input model. So the output has to be filtered to
 separate the relevant information from noise.

Perhaps better concept:
Our intention was to catch the thrown exceptions at the location
where the model is iterated and the generation triggered for each
element, and to retry the generation after setting the whole system
into DEBUG mode - and setting it back to its former state after
catching the exception again(!)

   Advantage:
   * We would get a verbose track of what the system does,
 but only with the critical model element, not with all
 others.
   * The debug info would automatically be created during the
 first run by the app. developer. So no need to completely
 rerun, no need to configure, no need to involve our dev.
 team at this stage.


Here's our log4j problem why I post now:

As the basic configuration is just complex, involving many
loggers and appenders, we can't only set one or two logger
into debug mode. Settings at some upper level in the
hierarchy don't help, as some loggers much deeper are configured
explicitly and keep their own setting.

Reconfiguring with another property set would presumably
cause rolling file appenders to create a new generation
after restoring the configuration (?).

So we tried to write a RepositorySelector do retrieve another
(much simpler) hierarchy in case the system goes into debug.

But this does not work either, as the Loggers are instanciated
and kept in static variables of classes (as recommended)
which are put into caches _before_ the system switches to DEBUG,
i.e.: The second hierarchy is mostly never queried, each instance
knows its logger.

So, what would be the right way to achieve a systemwide
switch to debug level and a reset to normal configuration
afterwards?

Any hints are welcome

KR
Dirk Detering

--
ISKV
Paul-Klinger-Straße 15
45127 Essen
Telefon  +49-(0)-201-1094-0
Fax  +49-(0)-201-1094-444
 http://www.iskv.de/

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Using Log4J

2007-01-25 Thread James Stauffer

There should be no problems doing that.  You will just want to set the
Threshold to ERROR on NEWCONSOLE.

On 1/25/07, Padmanaban Varatharajan [EMAIL PROTECTED] wrote:


Hi All,



In Log4J, I have to use the same properties file (log4j.properties) in
which I have certain configuration details already defined with the
following:



Existing: log4j.rootcategory=INFO, CONSOLE, LOGFILE



*  Default logging level is INFO and two appenders.

*  One is ConsoleAppender and the other is FileAppender.

*  And the threshold level is INFO for both the appenders



And my Requirement is

*  I need to use another appender, which will be
RollingFileAppender

*  The threshold level is INFO

*  Need to write the logging details in a different file.



Also

*  I would like to use another consoleAppender with the logging
level as ERROR. As the existing one is having INFO level.



Say: log4j.rootcategory=INFO, CONSOLE, LOGFILE, NEWFILE, NEWCONSOLE



Can anyone help me to achieve this? Also, tell me how to use the same in
the java code? Sample code will do better and appreciable.



Please respond me ASAP.



Thanks

Padmanaban



This message and the information contained herein is proprietary and 
confidential and subject to the Amdocs policy statement,
you may review at http://www.amdocs.com/email_disclaimer.asp




--
James Staufferhttp://www.geocities.com/stauffer_james/
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: How to use log4j (log4j.xml) and Maven and Junit??

2007-01-23 Thread James Stauffer

Try putting the log4j.xml in the working directory and not providing a
path (just the filename).  Also run with -Dlog4j.debug to see what
log4j finds.

On 1/23/07, Lisa [EMAIL PROTECTED] wrote:

I have written some JUnit tests and put them in the standard layout for test
cases under Maven.  The tests use log.debug(msg), log.info(msg) etc.

The tests run OK.

So now I created a simple log4j.xml file with an appender and a logger that
filters only the logging messages in my test case (by package).

When I run maven (mvn test), how do I tell it where my log4j.xml is and how to
use log4j logging?

I have tried everything.  I edited the mvn script under the install directory
to include the following:

 exec $JAVACMD \
   $MAVEN_OPTS \
   -classpath ${M2_HOME}/core/boot/classworlds-*.jar \
   -Dclassworlds.conf=${M2_HOME}/bin/m2.conf \
   -Dmaven.home=${M2_HOME}  \
   -Dmaven.junit.sysproperties=log4j.configuration \
   -Dlog4j.configuration=file:C:\tmp\log4j.xml \
   ${CLASSWORLDS_LAUNCHER} $QUOTED_ARGS


this does not work (have tried with and without file:.

---
I have included a something similiar on the mvn command line:
   mvn -Dlog4j.configuration=c:\tmp\log4j.xml  test

this does not work (have included =file:c:\tmp... as well

---
I have also tried setting properties in the pom.xml like so:

plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-surefire-plugin/artifactId
configuration
skipfalse/skip
useFilefalse/useFile

systemProperties
property
namemaven.junit.sysproperties/name
valuelog4j.configuration/value
/property
property
namelog4j.configuration/name
valuefile=:c:\tmp\log4j.xml/value
/property
/systemProperties
/configuration
/plugin

---
and

plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-surefire-plugin/artifactId
configuration
skipfalse/skip
useFilefalse/useFile

systemProperties
property
namemaven.junit.sysproperties/name
valuelog4j.configuration/value
/property
property
namelog4j.configuration/name
valuec:\tmp\log4j.xml/value
/property
/systemProperties
/configuration
/plugin

--- and  (log4j.xml is in same directory as pom.xml) this does not work either.


plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-surefire-plugin/artifactId
configuration
skipfalse/skip
useFilefalse/useFile

systemProperties
property
namemaven.junit.sysproperties/name
valuelog4j.configuration/value
/property
property
namelog4j.configuration/name
valuelog4j.xml/value
/property
/systemProperties
/configuration
/plugin


---
none of these work.  Any ideas on how to integrate Maven2, Log4J and Junit would
be greatly appreciated.


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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 and Serializable classes

2007-01-22 Thread James Stauffer

I don't quite understand.  Do you want to serialize log4j classes?
Anytime that you serialize an object both the client and server need
all classes that the object uses.  If the object has a log4j Logger
than both the client and server should have log4j.jar in the
classpath.

On 1/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi,

Log4j works in objects that implements Serializable?

If so, how this is possible? If a client receives an object from the server that
implements Serializable, how the client knows how to interpret log4j
instructions?

Sincerely,
Pedro

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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Missing loggers from getCurrentLoggers() under WAS 5.x

2007-01-19 Thread James Stauffer

The difference can probably be explained as a difference in
LoggerRepositories.  There is a servlet (LogWeb?) that allows config
changes so it migh have some clues to help you.

On 1/19/07, Ostermueller, Erik [EMAIL PROTECTED] wrote:



Hello,

I'm writing some code that will turn log4j(1.2.8) logging on and off at
runtime.  I'll probably expose this via jmx.
I've seen solutions out there to re-read a configuration file and this
is not what I want to do.

Instead, I want the code to discover all the loggers in use by my EAR
(deployed under WAS 5.x ) and enable the JMX user to:

-view the list of all loggers
-set the logging levels on any one of the loggers.

Under jonas, this works like a dream.
Invoking myLogger.getLoggerRepository().getCurrentLoggers() unleashes a
gusher of loggers of every variety.
hibernate, struts, betwixt, etc...
I can pick over the results and invoke setLevel() on the ones I care
about.
Logging levels are jumping up and down and the world is a happy place.
Enter WebSphere Application Server 5.x [thunder, lightning, dark
clouds].

With WAS, the getCurrentLoggers() returns just a small subset of all the
loggers in use.
The ones I mentioned above, for instance, are ones that show up in jonas
but not websphere.
The ones in my own package space are there in both jonas and websphere.
So why did some disappear and not others?  Where did they all go?  -- we
use struts and the others equally in both jonas and was.

Using the following WAS add-on (a classloader viewer), I'm probably
going to find my missing loggers.

http://ecommunity.groupintelligence.com/websphere/forums/showthread.php?
p=2353#post2353

My question is, what should I do next if I do find them?
I suppose I'll try to find an api to traverse the classloaders, but that
sounds plain nasty.
Surely someone has done this before.

I've posted this question on a WebSphere forum and I didn't get as much
as a peep out of them.
http://ecommunity.groupintelligence.com/websphere/forums/showthread.php?
p=2353#post2353

The people who wrote the following doc seem to know what they're talking
about:
http://mattfleming.com/files/active/0/ibm.pdf

I tried their JCL option 3 + EAR and unfortunately, the hibernate and
other loggers were still missing.

If anyone thinks it will help, I could post the lists of loggers that
did/didn't show up.

Thanks all,


--Erik Ostermueller


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Logging to multiple files, per context

2007-01-18 Thread James Stauffer

Search the archive for logging to one file per thread.

On 1/18/07, Rudi [EMAIL PROTECTED] wrote:

Hello,

I have a hand coded server which handle multiple sessions at one time (of
course, its a server after all). Each session would be handled by dedicated
thread. It is a requirement that incoming and outgoing messages be logged on
separate files, using the session specific attribute as the context.
What i want to ask is, what's the 'official' log4j way of doing such thing
and where can i get the manual? I am pretty sure that there is at least one
such way since i encountered the term 'multiple hierarchy trees' several
times, yet couldnt found any further hint.

regards,

rudi

--
http://www.bungrudi.com/





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Confirm successful reading of a conf file, check if loggers and appenders were instatntiated

2007-01-18 Thread James Stauffer

I believe the reason that log4j configuration doesn't thow exceptions
is that normally logging isn't the core reason for the program and a
problem with logging shouldn't stop the program.

If you look through the API I believe you will find methods to obtain
attached appenders so you could verify that way (but then your code
would have to know about your config).

On 1/18/07, Marcel Gołuński [EMAIL PROTECTED] wrote:

Hello.
I made a little research before posting here. And i didn't find any
interesting answers.

Major question:

(from log4j wiki's FAQ - not answered
(http://wiki.apache.org/logging-log4j/FrequentlyAskedQuestions) )
How can I get notified of errors during configuration and then handle them?
For example, I want to log to a file but the directory does not exist yet. I
want to catch that configuration error, create the directory and restart
configuration.
(from wiki's requested features
(http://wiki.apache.org/logging-log4j/Log4jRequestedFeatures) )
PropertyConfigurator.configure() and doConfigure() methods should return
some sort of status to know if the loaded properties are valid.

I'm using DOMConfigurator (configureAndWatch) to read a conf file for a
jboss webapp (log4j1.2.8, checked 1.2.14 nothing changed). I want to know if
the reading was successful. I think that there is no exeption thrown (even
if file does not exist, not only on validation errors).
my questions:
- Is there any way to check if the conf file was read successfully (I may
switch to properties configuration if it is supported there)
- Is there any way to check on configureAndWatch that file was actually
reread and configuration changes were made. (For example to attach some
actionPerformer to log4j configureAndWatch which will be triggered when
reading occures.) (I suppose no)?
-
Minor questions:
NOTE: I know that file appenders throw exeptions so it is easy there.

How can i determine that appenders and loggers were instantiated (created)?
my idea (not checked but i think working):
- logger
org.apache.log4j.LogManager
method: exist()

- appender (after attaching to a logger)
org.apache.log4j.Logger (exactly Category super class)
methods: isAttached(), getAppender(), getAllAppenders() (and Enumerate for
the one im trying to check)

Is there any other way (easier, faster) to determine that loggers and
appenders were created and attached succesfully?
Its a pity that log4j does not support exceptions, but i understand the
performance issue, and think that it is connected with the lack of
exceptions.

Sorry for my English.

Best Wishes,
--
Marcel Golunski
Horus s.c. http://www.horus.com.pl


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





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


Re: Confirm successful reading of a conf file, check if loggers and appenders were instatntiated

2007-01-18 Thread James Stauffer

Could the configure method be changed to return a boolean indicating
sucess?  If someone detected that configuration failed, would log4j be
in an undefined state so that configuring with another file might not
produce the desired results?

One way to detect config problems would be to run with -Dlog4j.debug
and capture and parse System.out info produced by log4j.

On 1/18/07, Curt Arnold [EMAIL PROTECTED] wrote:


 On 1/18/07, Marcel Gołuński [EMAIL PROTECTED] wrote:

 Is there any other way (easier, faster) to determine that loggers and
 appenders were created and attached succesfully?
 Its a pity that log4j does not support exceptions, but i
 understand the
 performance issue, and think that it is connected with the lack of
 exceptions.


On Jan 18, 2007, at 9:39 AM, James Stauffer wrote:

 I believe the reason that log4j configuration doesn't thow exceptions
 is that normally logging isn't the core reason for the program and a
 problem with logging shouldn't stop the program.

 If you look through the API I believe you will find methods to obtain
 attached appenders so you could verify that way (but then your code
 would have to know about your config).


My understanding is the lack of exceptions from the configurators was
not motivated by performance concerns, but that a bad configuration
file would not cause an otherwise working application to fail.
Unfortunately, that design decision makes it difficult to
programatically respond to configuration failures, like providing a
backup configuration if the configuration file was missing.

I did start an experimental project (search for strictxml) in the
sandbox for new XML configurator that used a stricter syntax and
provided more feedback on the processing of the configuration.
However, that has been dormant for a while and probably will not see
much addition effort until log4j 2.0 development starts whenever that
is.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





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


Re: Use category to limit by package name possible?

2007-01-16 Thread James Stauffer

1. category - logger
2. Remove class attribute from category/logger.
3. Define a root node at the bottom.

On 1/16/07, Lisa [EMAIL PROTECTED] wrote:

I have read all the documentation I could find on using an XML config file for
Log4J (slim pickings) but can not figure out how to log INFO messages to a file
that come from a specific package.

Any help would be appreciated.

I have a file appender that I want to limit to:
 1.  info
 2.  by package name

My appender looks like this:
!-- *** --
!-- Appender used for all JSF debugging --
appender name=JSF.INFO.LOG
  class=org.apache.log4j.DailyRollingFileAppender
param name=File value=jsf.info.log/
param name=Append value=false/
param name=ImmediateFlush value=true/
param name=Threshold value=info/
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern
   value=%d %-5p [%t] %c %C (%F:%L) - %m\n/
/layout
/appender

The limiting categories looks like this:
!-- JSF Limiting Categories --
!-- myfaces-api --
category
name=org.apache.log4j.xml
additivity=false
class=javax.faces
priority value=info/
appender-ref ref=JSF.INFO.LOG/
/category

!-- myfaces-impl --
category
name=org.apache.log4j.xml
additivity=false
class=org.apache.myfaces
priority value=info/
appender-ref ref=JSF.INFO.LOG/
/category

The idea is to have all INFO messages from org.apache.myfaces  javax.faces go
to a jsf.info.log file.


---
Here is the exception that I get what I get when I launch my servlet/jsp/jsf
container (running under tomcat)


log4j: Desired logger sub-class: [javax.faces]
log4j:ERROR Could not retrieve category [org.apache.log4j.xml]. Reported error
follows.
java.lang.ClassNotFoundException: javax.faces
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)


---
I have the javax.faces (jar) packaged in my web application (war), which is then
deployed to Tomcat (which is now configured to use log4j)

---
Also is is possilbe to specify that the log file should go under
$CATALINA_HOME/logs?

How do I specify in the XML file where the log file should go?

Thanks

Lisa


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: Want to maintain different logs for different users, in different files on the basis of user type

2007-01-15 Thread James Stauffer

How many different types of users do you have?  Are all types known
ahead of time?

On 1/15/07, Gajendra Pingalkar [EMAIL PROTECTED] wrote:

In my application, currently we r maintaining all logs in same file of Log4j.
Instead of that, i want to maintain logs seperatly depend-upon his user-type.
Whenever a specific user has get login, his information has been maintain in a
specific file, all other user has get login, same type as previous user, being
maintain in same file. When different type of user has get login, his
information should maintain in different file. As per considering my
requirement, please suggest some helpful idias and also code snipets , etc

Thanks and Regards,
Gajendra Pingalkar


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





--
James Staufferhttp://www.geocities.com/stauffer_james/
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: cannot write to a file with rollingfileappender in log4j1.3

2007-01-15 Thread James Stauffer

Even though DOMConfigurator is depreciated it may still work and it
may be worthwhile to try it to see if your config is ok.

On 1/15/07, Surya Poola [EMAIL PROTECTED] wrote:

Dirk,

  Thanks for your help,but iam sorry to query you once more:

  I already have gone through the document.My question is in log4j 1.2.8 i was 
using the following for DailyRollingFileAppender to map to configuration file :
  DOMConfigurator.configure(mLOG4JCONFIGFILE);
where mLOG4JCONFIGFILE was the property where i mentioned the location of xml 
file.

  But in 1.3 alpha-8,DOMConfigurator is depracated.

  So iam forced to use joranconfigurator,  by which iam not able to write to 
file,ie, file is not created.I am mentioning my program as follows:
  JoranConfigurator jc = new JoranConfigurator();
jc.doConfigure(mLOG4JCONFIGFILE, LogManager.getLoggerRepository());

  So can you let me kow how to configure with joranconfigurator or any other 
configurator.

  Thanks in advance

  Regards
  Rohan

Dirk Ooms [EMAIL PROTECTED] wrote:
  Rohan,

have a look at the 'Default Initalization Procedure' at 
http://logging.apache.org/log4j/docs/manual.html
it explains how log4j will find your config file.

dirk

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




-
No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.




--
James Staufferhttp://www.geocities.com/stauffer_james/
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]



  1   2   3   4   5   6   7   >