is there anything in log4j that can enable me to do this.....?

2003-06-26 Thread Michael . Teji
Hello people!

I been wondering about a requirement i have.  I am sure it can probably be
done using log4j using Socket/JMS Appender???
But thought i check if its possible to do this in log4j (i am no expert in
the advanced topics of log4j):

-  Receive alert messages over TCP/IP from another application.

- Format the information as required and send it to the appropriate 3rd
party tool.


Am i right We can do this using the Appenders i mentioned above??//


Thanks for any help you can give.

___
 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Statements and opinions expressed in this e-mail may not
represent those of the company. Any review, retransmission, dissemination
or other use of, or taking of any action in reliance upon, this information
by persons or entities other than the intended recipient is prohibited. If
you received this in error, please contact the sender immediately and
delete the material from any computer. This e-mail may be read by an
employee of the company as part of the internal monitoring process and is
therefore not to be considered private by the sender or the recipient.



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



RE: is there anything in log4j that can enable me to do this.....?

2003-06-26 Thread Shapira, Yoav

Howdy,
You can use sockets (appender / receiver / or hub) the whole way.  You
can also use the JMSAppender/JMSSink.  You're right this is doable using
log4j.  Check out how chainsaw works.

Log4j 1.3 will have even more support for this, via pluggable Receivers
for logging events.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 5:26 AM
To: [EMAIL PROTECTED]
Subject: is there anything in log4j that can enable me to do this.?

Hello people!

I been wondering about a requirement i have.  I am sure it can probably
be
done using log4j using Socket/JMS Appender???
But thought i check if its possible to do this in log4j (i am no expert
in
the advanced topics of log4j):

-  Receive alert messages over TCP/IP from another application.

- Format the information as required and send it to the appropriate 3rd
party tool.


Am i right We can do this using the Appenders i mentioned
above??//


Thanks for any help you can give.

___


 The information transmitted is intended only for the person or entity
to
which it is addressed and may contain confidential and/or privileged
material. Statements and opinions expressed in this e-mail may not
represent those of the company. Any review, retransmission,
dissemination
or other use of, or taking of any action in reliance upon, this
information
by persons or entities other than the intended recipient is prohibited.
If
you received this in error, please contact the sender immediately and
delete the material from any computer. This e-mail may be read by an
employee of the company as part of the internal monitoring process and
is
therefore not to be considered private by the sender or the recipient.



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




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



common-logging, struts, Log4j, tomcat

2003-06-26 Thread rablists
Hi. I have problem in using the common-logging with struts and 
Log4j. I am basically lost. I  have short questions, I appreciate if 
anyone can help me little bit. these are the questions with examples:

The file outputfile.log that I specify in 
log4j.appender.LOGFILE.File=outputfile.log where it is located? 
where I find it? is it physical file?

I dont know why my configuration is not working, although I put the 
following files in the classpath WEB-INF/classes/org/myclasses/:

commons-logging.properties:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL
ogger

log4j.properties:
log4j.rootLogger=DEBUG, rolling
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%
n
log4j.appender.rolling=org.apache.log4j.RollingFileAppender
log4j.appender.rolling.File=outputfile.log
log4j.appender.rolling.MaxFileSize=100KB
log4j.appender.rolling.MaxBackupIndex=1
log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p %
c - %m%n

What else should I specify, or configure to make it to work? I have 
log4j-1.2.4.jar in my WEB-INF/lib/

Should I set any system propreties? or web.xml? or struts-config? 

In my classes I am doing that:
  protected static final org.apache.commons.logging.Log log = 
org.apache.commons.logging.LogFactory.getLog(this.class);

if (log.isDebugEnabled()) 
  log.debug(getMessage( + locale + , + key + ));

(How can I enable/disable the Debug or Trace?)


Thank you in advance. I am really stuck and I couldnt make it to 
work. I am using tomcat 4.18


Rabih



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



RE: common-logging, struts, Log4j, tomcat

2003-06-26 Thread Shapira, Yoav

Howdy,

The file outputfile.log that I specify in
log4j.appender.LOGFILE.File=outputfile.log where it is located?
where I find it? is it physical file?

The file is relative to the current working directory of the server.
Instead of using a patch like that, try something like
Log4j.appender.LOGFILE.File=$CATALINA_HOME/logs/outputfile.log
(for tomcat -- substitute the appropriate logs directory for your
server, or any absolute path if you'd like).

Of course, the server account needs to have write permission to the file
and directory you name.

I dont know why my configuration is not working, although I put the

Are there any error messages on the console or in your server logs?


following files in the classpath WEB-INF/classes/org/myclasses/:

Try putting them simply in WEB-INF/classes.

log4j.properties:
log4j.rootLogger=DEBUG, rolling
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%
n

You probably want stdout at the root logger as well, at least for
debugging, so log4j.rootLogger = DEBUG, stdout, rolling

What else should I specify, or configure to make it to work? I have
log4j-1.2.4.jar in my WEB-INF/lib/

This is the correct location for log4j.  I recommend you update to the
latest log4j (1.2.8) if possible.

Should I set any system propreties? or web.xml? or struts-config?

None of those are essential.  If you're still having problems, add
-Dlog4j.debug=true to your java command to get debug output out of
log4j.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: common-logging, struts, Log4j, tomcat

2003-06-26 Thread Jacob Kjome
At 12:51 PM 6/26/2003 +, you wrote:
Hi. I have problem in using the common-logging with struts and
Log4j. I am basically lost. I  have short questions, I appreciate if
anyone can help me little bit. these are the questions with examples:
First, if you are using commons-logging, then that is a question for 
another list.  If you are using log4j directly, which your configuration 
file below seems to suggest, then read on...

The file outputfile.log that I specify in
log4j.appender.LOGFILE.File=outputfile.log where it is located?
where I find it? is it physical file?
If you specify your file like this, it will be written to the location 
where the JVM is started.  If you are using Tomcat's startup scripts, then 
this would be in CATALINA_HOME/bin.  Look there for your outputfile.log.

I dont know why my configuration is not working, although I put the
following files in the classpath WEB-INF/classes/org/myclasses/:
huh?  How did you come up with this as a valid place to put your 
log4j.properties file for automatic discovery by log4j?  Try plain old 
WEB-INF/classes which is where it should be.

commons-logging.properties:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL
ogger
No idea.  This list isn't about commons logging, nor do I encourage its use 
since it seems to be the cause of so many problems.  Just use log4j 
directly if possible, although I know struts uses it so you have to have it 
present there.

log4j.properties:
log4j.rootLogger=DEBUG, rolling
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%
n
log4j.appender.rolling=org.apache.log4j.RollingFileAppender
log4j.appender.rolling.File=outputfile.log
log4j.appender.rolling.MaxFileSize=100KB
log4j.appender.rolling.MaxBackupIndex=1
log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p %
c - %m%n
This looks fine.  If you follow my comments above, this should work.

What else should I specify, or configure to make it to work? I have
log4j-1.2.4.jar in my WEB-INF/lib/
Why are you using such an ancient version of log4j?  log4j-1.2.8.jar is the 
latest and has some important fixes, so I highly recommend the upgrade.

Should I set any system propreties? or web.xml? or struts-config?

In my classes I am doing that:
  protected static final org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog(this.class);
if (log.isDebugEnabled())
  log.debug(getMessage( + locale + , + key + ));
(How can I enable/disable the Debug or Trace?)
No idea.  Again, this is commons-logging you are talking about.  Ask their 
list.


Thank you in advance. I am really stuck and I couldnt make it to
work. I am using tomcat 4.18
Why not Tomcat-4.1.24, the latest bugfixed version of Tomcat?  Again, I 
highly recommend the upgrade.

Jake


Rabih



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


Re: common-logging, struts, Log4j, tomcat

2003-06-26 Thread rablists
Thank you Yoav. It worked fine. The properties files should be under 
WEB-INF/classes directly. Plus, the major problem was with the 
commons-logging jar files, I should put in WEB-INF/lib only the 
commons-logging.jar, and delete the commons-logging-api.jar which 
should be placed under the tomact/common/lib/



--- In [EMAIL PROTECTED], Shapira, Yoav [EMAIL PROTECTED] 
wrote:
 
 Howdy,
 
 The file outputfile.log that I specify in
 log4j.appender.LOGFILE.File=outputfile.log where it is located?
 where I find it? is it physical file?
 
 The file is relative to the current working directory of the 
server.
 Instead of using a patch like that, try something like
 Log4j.appender.LOGFILE.File=$CATALINA_HOME/logs/outputfile.log
 (for tomcat -- substitute the appropriate logs directory for your
 server, or any absolute path if you'd like).
 
 Of course, the server account needs to have write permission to 
the file
 and directory you name.
 
 I dont know why my configuration is not working, although I put 
the
 
 Are there any error messages on the console or in your server logs?
 
 
 following files in the classpath WEB-INF/classes/org/myclasses/:
 
 Try putting them simply in WEB-INF/classes.
 
 log4j.properties:
 log4j.rootLogger=DEBUG, rolling
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - 
%m%
 n
 
 You probably want stdout at the root logger as well, at least for
 debugging, so log4j.rootLogger = DEBUG, stdout, rolling
 
 What else should I specify, or configure to make it to work? I 
have
 log4j-1.2.4.jar in my WEB-INF/lib/
 
 This is the correct location for log4j.  I recommend you update to 
the
 latest log4j (1.2.8) if possible.
 
 Should I set any system propreties? or web.xml? or struts-config?
 
 None of those are essential.  If you're still having problems, add
 -Dlog4j.debug=true to your java command to get debug output out of
 log4j.
 
 Yoav Shapira
 
 
 
 This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, 
proprietary and/or privileged.  This e-mail is intended only for the 
individual(s) to whom it is addressed, and may not be saved, copied, 
printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your 
computer system and notify the sender.  Thank you.
 
 
 ---
--
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


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



RE: is there anything in log4j that can enable me to do this.....?

2003-06-26 Thread Paul Smith
 Thanks for ur advice Yoav,
 
  pluggable Receivers for logging events... whats this???
 

Hi Michael, 

Receivers are the sibling of Appenders.  Appenders take an event from Log4j
and take them outside the log4j environment (to a file, socket, JMS topic,
SMTP etc).  Receivers take an external event (say, from a Socket) and push
or 'post' them into their local Log4j environment.  Receivers are great for
getting hold of Log4j events from a remote location.  Chainsaw uses them
extensively.

If Chainsaw wasn't enough to help you monitor events from a remote location,
you could always mimic something by writing it yourself.  Write a program
that configures Log4j to use a Receiver to suck external events into the
programs local log4j environment, then configure appenders in that same
local log4j environment configured to catch the events you're interested in
and react accordingly.  (this is all Chainsaw does! :) )

Paul Smith

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



Re: Accessing multiple log files

2003-06-26 Thread Thomas Lionel SMETS
Yes you are right but ...
using a timer would force the usage of 2 different approaches / pieces 
of code :  
   1°. For normal code
   2°. For EJB / Application Server

Thomas,

Milind Rao wrote:

Any help from some one with more experience with log4j would be appreciated.  

One other thing I noticed with the DailyRollingFileAppender is that no timer is being used.  So when the rollover time 
occurs, a new file is not created.  A new file is created only on the first log event after the rollover time has elapsed.  This 
doesn't seem right to me.  Another benefit of using the timer is that the call to rollover on every logging event could be 
eliminated.  Should be more efficient for everything except rollover per minute.

 

I'm looking at using log4j to do logging in our application.  Multiple clients on 
different machines will be logging events.  
The Message object in the LoggingEvent class is an instance of a  proprietary Log 
class that contains a date.  The Log 
class implements ObjectRenderer and contains a Date object.The events are date 
based.  Each day will have its own 
log file (This is a requirement).  So far, I could have used log4j almost as is, 
implementing just the ObjectRenderer.  But 
there is one requirement for which I have to do some specialisation.

For the most part, almost all the logging events will be for the current date, but 
occasionally, the date object in the 
message could be an earlier date.  If I use FileAppender (or DailyRollingFileAppender) 
it will append all logs to the 
current log file.  However I need to be able to append the event to a previous day's 
log file depending on the value of the 
date in the message.

After going through the log4j code, I think I have to subclass FileAppender (or 
DailyRollingFileAppender) and redefine 
the append method to compare the file with the specified date and open the 
appropriate log file if required.  (If I 
redefine the subappend method, the checkEntryConditions will have been done for 
the current date's file).

My questions are

1. To begin with, is this the right approach?

2. Is append thread safe?  I believe it is based on the synchronized code block in 
the callAppenders  method of 
Category.  But that's not the black box behaviour.  Can I make assumptions based on 
existing code?  I don't think so.  
But I wonder about performance if I have to set up synchronized blocks in my subclass.

3. Should I call activateOptions after setting the file name?  I expected to see a 
call to activateOptions in the rollover 
method of the DailyRollingFileAppender class, but it seems it's getting called from 
somewhere else.  Where?

4. The setFile method closes the file.  So if I have interleaved logging events for 
different dates, this will be rather 
inefficient.  I could redefine reset to no-op and close the files (from a list) in a 
redefined rollover method.  Will this 
have some side-effect?  Seems fragile.  Might break in a later version of log4j.
   



Regards
Milind


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