| Hi,
|
| I am fairly new to Log4J and I have the following questions.
|
| By default if I use the ConsoleAppender or any other appender other
| than AysncAppender, they are all synchronous. Correct?
Yes.
| 1. To use the appender in an aysnc way, I have to extend it from the
|
...
} catch( Exception e ) {
logger.debug( e.getMessage(), e );
}
...
--
Thomas
| -Original Message-
| From: Andreas Bothner [ MTN - Innovation Centre ]
| [mailto:[EMAIL PROTECTED]
| Sent: 29 August 2003 14:55
| To: Log4J Users List
| Subject: how do I log an exception
http://jakarta.apache.org/log4j/docs/index.html
--
Thomas
| -Original Message-
| From: nraokonjeti [mailto:[EMAIL PROTECTED]
| Sent: 06 August 2003 12:20
| To: [EMAIL PROTECTED]
| Subject: how to catch exception messages in log4j.
|
|
| hi all,
| I have one application. I have to
Sudhakar,
The javadoc for org.apache.log4j.net.SocketServer clearly states that you
may have a configuration file for each client that connects to it, and if
not present a generic configuration file is applied.
Hope this helps,
--
Thomas
| -Original Message-
| From: Satrasala,
The LoggingEvent implements the java.io.Serializable interface, so you're
free to dump it to any storage media of your discretion and read it back as
a java object.
The SocketAppender uses this technique already; the LoggingEvents are
serialised and streamed over a socket to a SocketServer.
It's
Log4j gurus,
I'm using multiple hierarchies and configuration files. The additional
hierarchies (seen from the main hierarchy which is configured during
startup) read configuration from several XML configuration files. Only the
first file they read has a root Logger and an inherent appender.
From the PropertyConfigurator javadoc:
You can customize the way message objects of a given type are converted to
String before being logged. This is done by specifying an ObjectRenderer for
the object type would like to customize.
The syntax is:
Milin,
| Thanks for the quick response. I don't see anything specifically
| written about file locking in the java.io.Writer.
Of course not. java.io.Writer is a generic (abstract) character emitter and
leaves the media specifics to the subclasses, such as FileWriter. I wanted
to draw your
web: http://www.ubis-ag.com
| ---
|
| -Ursprüngliche Nachricht-
| Von: Thomas Muller [mailto:[EMAIL PROTECTED]
| Gesendet: Montag, 30. Juni 2003 17:44
| An: [EMAIL PROTECTED]
| Betreff: Multiple configuration files - single contra multiple
| hierarchies
|
|
| Fellow Log4j users
Fellow Log4j users,
Would appreciate some input on how to design a solution for a problem I'm
facing regarding multiple Log4j configuration files.
One of the modules in our system (the module consists of a significant
number of classes) is in the process of being redesigned such that the
system
You need to set the relevant System variable prior to log4j configuration,
e.g. with the -D option to the VM.
--
Thomas
| -Original Message-
| From: Jenny [mailto:[EMAIL PROTECTED]]
| Sent: 16 January 2003 17:54
| To: Log4J Users List
| Subject: Re: log4j.xml and variable
You need the JavaBeans Activation Framework (JAF)(activation.jar).
Downloadable from http://java.sun.com/products/javabeans/glasgow/jaf.html.
Hope this helps,
--
Thomas
| -Original Message-
| From: Wilfred Ho [mailto:[EMAIL PROTECTED]]
| Sent: 16 January 2003 18:03
| To: [EMAIL
.
|
| Thanks.
|
| --- Thomas Muller [EMAIL PROTECTED] wrote:
| You need to set the relevant System variable prior
| to log4j configuration,
| e.g. with the -D option to the VM.
|
| --
|
| Thomas
|
|
|
|
| | -Original Message-
| | From: Jenny [mailto:[EMAIL PROTECTED]]
| | Sent: 16
| 1. How do i specify a relative path to this file name, so that it can be
| created under j2ee/home/log/test.log. This j2ee/home may be under some
| other top level dir ?
Before log4j is configured, insert the application server home path in the
System properties, e.g.
System.setProperty(
| 1. My first issue is, how does it gets this path, based on what
| nbsp;system parameter
| it takes up this value /j2ee/home/ and prepend it to log file ?
The /j2ee/home is probably the VMs current working directory, this is why
you find your files under this directory (unless you have specified
MDC and NDC are your friends.
--
Thomas
| -Original Message-
| From: Lutz Michael [mailto:[EMAIL PROTECTED]]
| Sent: 07 January 2003 18:20
| To: 'Log4J Users List'
| Subject: User-level filtering
|
|
|
|
| Has anyone by any chance figured out a slick way to implement user-level
|
classes with the same fully qualified class name used across an
| application's business functions.
|
|
|
|
| -Original Message-
| From: Thomas Muller [mailto:[EMAIL PROTECTED]]
| Sent: Tuesday, January 07, 2003 1:22 PM
| To: Log4J Users List
| Subject: RE: User-level filtering
|
|
| MDC and NDC
Selwyn,
Have you considered increasing the stack/heap size? Read the documentaion
for the -Xmx -Xss java JVM options.
The problem with AsyncAppender is that it runs in a one-per-instance thread
and it has a fixed buffer size. A more effective AsyncAppender would share a
single thread (or maybe
| How many AsyncAppenders are you running?
Many.
| A more effective AsyncAppender would share a
| single thread (or maybe use a thread pool) between all
| instances. It would
| also use a linked list for storing log events instead of a fixed size
| buffer. This would also solve another issue the
Selwyn,
I don't think the out-of-memory error is related to Log4j's AsyncAppender
(of anything in Log4j for that matter). As long as you don't explicitly
increase the buffersize, it's memory consumption should be constant.
Are you creating appenders programmatically? In case you are, my guess is
Both PropertyConfigurator and DOMConfigurator support rudimentary variable
interpolation from the System properties.
java -Dmylog.dir=/usr/home/foo/log Foo.java
And in your config file:
appender name=FOO_APPENDER class=org.apache.log4j.FileAppender
param name=File
Rami,
First: please use plain text _only_ for mailing-list and Usenet postings.
The way to configure CompositeRollingAppender (and all other appenders) is
to use the mutator methodnames in your configuration file. If the class e.g.
describes setFeatureFoo( int foo ), your configuration file may
DOMConfigurator.configureAndWatch() is your friend.
--
Thomas
| -Original Message-
| From: Kohinoor Lal Verma (EHS) [mailto:[EMAIL PROTECTED]]
| Sent: 09 December 2002 14:02
| To: 'Log4J Users List'
| Subject: Changing logger configuration at runtime
|
|
| Hi all,
|
| Can someone tell
| Is it true?
Yes. If you consult the javadoc for org.apache.log4j.AsyncAppender in log4j,
you will find the statement:
Important note: The AsyncAppender can only be script configured using the
DOMConfigurator.
Hope this helps.
--
Thomas
| We have a java class that calls
| Logger.getLogger(Main.class);
|
| Am i correct in assuming the logfile would be main.log
No. Read the Log4j documentation at
http://jakarta.apache.org/log4j/docs/documentation.html.
--
Thomas
Li,
As far as I understand log4j has no built-in mechanism aimed at facilitating
what you ask for, but it's not hard to code this functionality yourself. You
can e.g. use java.lang.ThreadLocal.
public class Foo {
private static final ThreadLocal THREAD_LOCAL_LOGGER = new ThreadLocal()
{
No - but feel free to write a formatting flexible HTMLLayout and submit it!
--
Thomas
| -Original Message-
| From: Graham Mead [mailto:[EMAIL PROTECTED]]
| Sent: 29 November 2002 15:46
| To: [EMAIL PROTECTED]
| Subject: HTML Layout
|
|
| Hi,
|
| We need to output logging info in HTML
| It should be a logger that takes a serializable object and serializes it
| to the appender. Then when an exception occurs we can go back and see
| the actual state of the objects as they where when the exception
| occurred.
| Does it exists and if not, what do you think of the idea?
I think
From the Log4j javadoc (NDC class):
The NDC class implements nested diagnostic contexts as defined by Neil
Harrison in the article Patterns for Logging Diagnostic Messages part of
the book Pattern Languages of Program Design 3 edited by Martin et al.
Addison-Wesley Pub Co; ISBN: 0201310112; 1st
| 1. Is there a way to monitor the queue of the async appender ?
Not without modifying the code.
| 2. If an Async appender is writting to a socket appender and if there is a
| network issue and the queue gets full, is there a way to
| overwirte the queue
| rather than block the user (not
Appenders should be thread-safe, hence a single appender can be added to
multiple loggers.
--
Thomas
| -Original Message-
| From: Wolfgang Stein [mailto:[EMAIL PROTECTED]]
| Sent: 27 November 2002 16:36
| To: [EMAIL PROTECTED]
| Subject: Connecting one Appender to several Loggers
|
|
Log4j has supported system properties interpolation in XML/properties
configuration files at least since I started using it (almost two years
ago).
Just add the variables to system properties before Log4j fires up, e.g. with
the -D option to the VM.
--
Thomas
| -Original Message-
|
package my.package;
public class FooRenderer implements org.apache.log4j.or.ObjectRenderer {
public String doRender( Object fooInstance ) {
return( foo instance is [ + fooInstance + ] );
}
}
In your XML config file:
renderer renderedClass=my.package.Foo
You find a short introduction to Log4j here:
http://jakarta.apache.org/log4j/docs/manual.html
A commercial manual can be found here:
http://www.flashline.com/components/view.jsp?prodid=4702affiliateid=657173
Also, you should peruse the javadoc of the vital classes in Log4j, such as
Logger,
Add interface:
public abstract interface SysupTimeResolver {
public abstract long getSysupTime();
}
Add the following to SNMPAppender:
private static final SysupTimeResolver DEFAULT_SYSUP_TIME_RESOLVER =
new SysupTimeResolver() {
long time = System.currentTimeMillis();
and of course, remove the setSysupTime() etc. This is rarely used
anyway since one generally don't want to keep track of actual appenders and
specially not in form of their types (in this case SNMPAppender).
--
Thomas
| -Original Message-
| From: Thomas Muller [mailto:[EMAIL
| I'm trying to get my jsp to work with log4j, I need to know how to set
| up the log4j properties file to log to a file.
| Can someone provide a example ? Thanks.
http://jakarta.apache.org/log4j/docs/manual.html
--
Thomas
It's included in Log4j now. See package org.apache.log4j.lf.* under the
source directory.
--
Thomas
| -Original Message-
| From: Whiting, Jeremy [mailto:[EMAIL PROTECTED]]
| Sent: 11 October 2002 11:18
| To: '[EMAIL PROTECTED]'
| Subject: Anyone remeber LogFactor5 ?
|
|
| Hi,
| I'm
| I have an environment variable called CATALINA_HOME that contains
| D:/Tomcat4.1
You need to set the variable in the System properties. Environment or shell
variables are _not_ automatically or magicly transferred to the java
properties.
Either start the VM with the -D option
(e.g.
-
| From: Thomas Muller [mailto:[EMAIL PROTECTED]]
| Sent: Wednesday, October 02, 2002 11:07 AM
| To: Log4J Users List
| Subject: RE: Relative path for FileAppender File
|
|
| | I have an environment variable called CATALINA_HOME that contains
| | D:/Tomcat4.1
|
| You need to set the variable
Actually, I would think the best thing to do is to allow an implementation
of an interface to be given in the configuration. This is quite in
accordance to how other parts of Log4j is configured, e.g. renderers and
filters.
The interfact could be something like this:
public abstract interface
);
|
| }
|
| greetings, thomas
|
| -Ursprüngliche Nachricht-
| Von: Thomas Muller [mailto:[EMAIL PROTECTED]]
| Gesendet: Montag, 23. September 2002 16:25
| An: Log4J Users List
| Betreff: RE: Name of rolled over files
|
|
| Actually, I would think the best thing to do is to allow
Keep in mind that the DailyRollingFileAppender is not supposed to roll over
exactly at the time specified, merely at the first log-event that occurrs
after that time is passed. The reason is simply that the rollover is handled
in the same thread as the logging occurrs.
--
Thomas
|
| Specifically I would like to know where it looks for the file when only a
| file name (and not a full path) is specified like john.txt instead of
| C:\john.txt.
Probably current user directory (see System.getProperty( user.dir ) ).
--
Thomas
| Is it possible to set additivity flag in the configuration file instead of
| setting it into code.
Yes, see http://jakarta.apache.org/log4j/docs/manual.html.
--
Thomas
*
Copyright ERA Technology Ltd. 2002.
DOMConfigurator supports rudimentary variable interpolation. Variables found
in the System properties can be used in the XML config file like this:
appender name=FOO class=org.apache.log4j.DailyRollingFileAppender
param name=file value=${log.home}/foo.log /
param name=append
Make sure that you compile the application with the debug info intact. If
you use Sun's compiler, the -g option controls this.
Also, some appenders require the locationInfo parameter to be set to true
to carry over class/method/line information.
Last, JIT compilation might optimize location
org.apache.log4j.DailyRollingFileAppender is your friend.
--
Thomas
| -Original Message-
| From: Maksims Markaitis [mailto:[EMAIL PROTECTED]]
| Sent: 15 August 2002 11:25
| To: 'Log4J Users List'
| Subject: How to make logging in another file for each day?
|
|
| How to make
I think this could be a good feature, but I guess will have to code it
yourself. You could write your own Layout class or extend e.g.
PatternLayout. Let ignoresThrowable() return false, and handle the throwable
yourself. You will have to construct the magic that filters the lines, maybe
by
Robert,
A glimpse at the sourcecode reveals that the HTMLAppender mercilessly
converts the brackets.
sbuf.append( Transform.escapeTags( event.getRenderedMessage() ) );
Inserting HTML code in the log message strikes me as a bad idea in the first
place, actually, log messages should
| Firstly I can not find any where a description of how to configure Log4j
| using a XML file instead of a property file.
You will find examples in the
LOG4j_HOME/src/java/org/apache/log4j/xml/examples. Also have a look at the
LOG4j_HOME/src/java/org/apache/log4j/xml/log4j.dtd file.
|
have an example you can share? Thanks.
| -billc
|
| -Original Message-
| From: Thomas Muller [mailto:[EMAIL PROTECTED]]
| Sent: Monday, July 01, 2002 2:01 PM
| To: Log4J Users List
| Subject: Correction!! (was: RE: XMLLayout conversion pattern)
|
| Perusing the code you can see
Try to set
param name=LocationInfo value=true /
for the appender you're using.
--
Thomas
| -Original Message-
| From: Christian, William [mailto:[EMAIL PROTECTED]]
| Sent: 01 July 2002 18:26
| To: Log4J Users List
| Subject: XMLLayout conversion pattern
|
|
| How
Perusing the code you can see that you will have to set LocationInfo *for
the actual Layout* in order to get class/method/line information. If you're
using SMTPAppender you're adviced to set LocationInfo for the appender as
well.
--
Thomas
| -Original Message-
| From: Thomas Muller
NDC and MDC are lightweith variants of what you want to achieve; that is,
you can assign a unique id to each log event (e.g. a username), and
filter/sort based on this id when perusing the log.
Another alternative is to create/get/restore an Appender programmatically
for each individual user.
55 matches
Mail list logo