How Can I Test DailyRollingFileAppender?

2008-05-12 Thread Robert Pepersack
Hi all, I tried to find an answer for my question in the archives, but I couldn't find it. Please forgive me if this is duplicate post. I'm trying to use DailyRollingFileAppender in the Spring IOC container (J2SE). My OS is Windows. I've tried to test if DailyRollingFileAppender creates an

Re: Setting logging levels

2008-05-06 Thread Robert Pepersack
You attach your logging level to your logger. You can specify your log4j configuration properties in file by using PropertyConfigurator.configure(String configFilename). You can also configure log4j by using some of the other methods of PropertyConfigurator. For example, you can create a java

Log Multi-Line Messages

2008-04-30 Thread Robert Pepersack
I'm logging the a message from a server that may span several lines. For example: 220 Connected to server. 220 Connection will close if idle for more than 5 minutes. When log4j prints this to my log file, the output looks like this: 2008-04-30 08:59:01 [MyThread] DEBUG MyClass.myMethod(): 220

Re: FileAppender Truncates Stack Trace

2008-04-24 Thread Robert Pepersack
t.format. On Apr 23, 2008, at 3:28 PM, Matthew Kemp wrote: > You can create your own custom object renderer that will properly > render the > whole stack trace. This renderer will need to be included in the log4j > config and be available on the classpath when log4j initializes.

FileAppender Truncates Stack Trace

2008-04-23 Thread Robert Pepersack
Hello, I'm using FileAppender to log to a log file. When an exception gets caught and printed, the stack trace is truncated as it usually is by default: Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Attempt to insert NULL value into column 'id', table 'table'; column does not allow nulls.

Same Configuration File, Different Hierarchies, and Different Log Files

2008-04-11 Thread Robert Pepersack
I have a RepositorySelector that manages several logging hierarchies and I want to send the output of each Hierarchy to its own log file. I would like to use the same configuration file for all of the Hierarchies, but have a different log file for each Hierarchy. I'm using PropertyConfigurator

Re: Specify Repository

2008-04-11 Thread Robert Pepersack
hat else to do. Why put all of this in a static initializer block in my selector? How would the MDC factor into this? Can you give more detail or an example? Thanks, Bob >>> "Jacob Kjome" <[EMAIL PROTECTED]> 04/10/2008 11:53 AM >>> On Thu, 10 Apr 2008

Re: Specify Repository

2008-04-10 Thread Robert Pepersack
fault repository (not its own), because the logger for the job was already created before the job executed (oh no). 8. Job finishes. 9. Job's repository name is removed from the MDC. Please help. Thanks, Robert Pepersack Senior Lead Developer Maryland Insurance Administration 410-468-2054 >&g

Re: Specify Repository

2008-04-10 Thread Robert Pepersack
ation). I currently have six jobs, so would I have six instances of Hierarchy that get reused again and again? Robert Pepersack Senior Lead Developer Maryland Insurance Administration 410-468-2054 >>> Jacob Kjome <[EMAIL PROTECTED]> 04/10/2008 10:34 AM >>> Are you confus

Re: Specify Repository

2008-04-10 Thread Robert Pepersack
reated by one thread as the container starts, and the objects' methods are executed by another thread (i.e. Quartz jobs). Since my loggers are created as instance variables, the MDC approach breaks down. Thanks, Robert Pepersack Senior Lead Developer Maryland Insurance Administration 410-4

Specify Repository

2008-04-09 Thread Robert Pepersack
DefaultRepositorySelector). Would anyone be interested in this, or am I barking up the wrong tree? I realize that this could open a can of worms with a lot of repositories getting created, but, if we're carful, this could be very useful. Thanks, Robert Pepersack Senior Lead Develo

Re: logging to catalica out only

2008-04-08 Thread Robert Pepersack
If you're running multiple web applications, and you want to log each one to its own file, then you have to create a RepositorySelector. How to do it is in Chapter 8 of "The complete log4j manual". I don't know why the logging level would affect where your output is sen

Re: Different Loggers for Different Instances of Same Class

2008-04-07 Thread Robert Pepersack
ts trigger fires), a *new* thread runs the job. So, how do I tell the RepositorySelector which hierarchy to choose for my other classes that a job uses? Thanks. Robert Pepersack Senior Lead Developer Maryland Insurance Administration 410-468-2054 >>> "Bender Heri" <[EMAIL

Re: Different Loggers for Different Instances of Same Class

2008-04-07 Thread Robert Pepersack
ng-log4j-user/200602.mbox/[EMAIL PROTECTED] Is there another way? Robert Pepersack Senior Lead Developer Maryland Insurance Administration 410-468-2054 >>> "Jacob Kjome" <[EMAIL PROTECTED]> 04/07/2008 1:42 PM >>> So, because you use Spring setter injection, you th

Re: Different Loggers for Different Instances of Same Class

2008-04-07 Thread Robert Pepersack
x27;t know how to get my loggers, and associate them with the current thread using the MDC, when they have already been created by the Spring IOC container. Do you know how? Thanks, Robert Pepersack Senior Lead Developer Maryland Insurance Administration 410-468-2054 >>> Jacob Kjome &

Re: Log Utility

2008-04-04 Thread Robert Pepersack
The Logger.isDebugEnabled() method applies to all of the classes that use your configured log4j repository. If you have your all of your loggers set to DEBUG, then Logger.isDebugEnabled() will return true, no matter what class it gets called in. Robert Pepersack Senior Lead Developer

Re: Log Utility

2008-04-04 Thread Robert Pepersack
if (this.debug) { logger.debug(new String("test")); } Hope this helps. Robert Pepersack Senior Lead Developer Maryland Insurance Administration 410-468-2054 >>> Tim Nguyen <[EMAIL PROTECTED]> 04/04/2008 3:02 PM >>> Hi, I am writin

Different Loggers for Different Instances of Same Class

2008-04-04 Thread Robert Pepersack
from JdbcFacadeA to go to the log for JobA, and I want the output from JdbcFacadeB to go to JobB's log. I'm using the log4j convention for naming loggers, which uses the fully qualified class name. How can I do this? Thanks, Robert Pepersack Senior Lead Developer Maryland Insurance Adm

Can I Put Non-log4j Properties in a Configuration File?

2004-04-29 Thread Robert Pepersack
Hello all. I currently have two configuration files: one for log4j and one for other properties. The other properties file includes key=value pairs for system information, such as the URL for finding EJBs (PROVIDER_URL = iiop://123.456.78.910:9000). I would like to combine the two files so

Re: An odd configuration need...

2004-04-29 Thread Robert Pepersack
You don't have to manage your disk space from within log4j. To conserve hard-drive space, you can use classes in the java.util.zip package to zip up your log files. You can schedule a nightly batch job that kicks off a Java class that uses java.util.zip. The book "Java i/O" by O'Reilly gives

Re: How Do I Find Out If log4j Has Been Configured?

2004-04-28 Thread Robert Pepersack
CVS? Which way performs the fastest, Logger.getRootLogger().getAllAppenders().hasMoreElements() or Log4jConfigurator.configure()? Thanks. At 05:52 PM 04/28/2004 +, you wrote: Quoting Robert Pepersack <[EMAIL PROTECTED]>: > Where can I get log4j 1.3? Is it in beta? > It isn&#

Re: How Do I Find Out If log4j Has Been Configured?

2004-04-28 Thread Robert Pepersack
Where can I get log4j 1.3? Is it in beta? Thanks, Bob At 03:06 PM 04/28/2004 +0200, you wrote: At 02:50 PM 4/28/2004, you wrote: Hi all. How can I programmatically find out if log4j has already been configured? I configure log4j in my ejbCreate() method using PropertyConfigurator.configure(

How Do I Find Out If log4j Has Been Configured?

2004-04-28 Thread Robert Pepersack
Hi all. How can I programmatically find out if log4j has already been configured? I configure log4j in my ejbCreate() method using PropertyConfigurator.configure("myfile.properties"). I don't want this to run every time my EJB container creates an instance of my bean class. I've looked in t

Re: How big is log4j?

2004-04-27 Thread Robert Pepersack
This approach will work, but you have to make sure that your application runs without throwing exceptions. I've done this with my client-side Sybase EAServer classes (the jar files for these classes add up to more than 10 MB), and found that just compiling is not a guarantee that the code will

Re: Possible/practical to make "debug" use one set of appenders, but "error" use a different set?

2004-04-22 Thread Robert Pepersack
Hi David. It's in Ceki's book, Chapter 3. You can set the threshold of an appender different from the threshold of its logger. Since you can have more than one appender for a logger, it follows that one logger can have appenders that are set to different thresholds. At 11:21 AM 04/22/2004

RE: Which Way of "Extending" Gives Fastest Performance

2004-04-22 Thread Robert Pepersack
ble affect on your performance than is that just wasted time? James Stauffer -----Original Message- From: Robert Pepersack [mailto:[EMAIL PROTECTED] Sent: Thursday, April 22, 2004 12:21 PM To: Log4J Users List Subject: RE: Which Way of "Extending" Gives Fastest Performance It shou

RE: Which Way of "Extending" Gives Fastest Performance

2004-04-22 Thread Robert Pepersack
factor out the tests, because I'm sensitive to performance. At 11:51 AM 04/22/2004 -0500, you wrote: Is the call to isDebugEnabled actually significant? James Stauffer -Original Message- From: Robert Pepersack [mailto:[EMAIL PROTECTED] Sent: Thursday, April 22, 2004 11:49 AM

Re: Which Way of "Extending" Gives Fastest Performance

2004-04-22 Thread Robert Pepersack
You could create a class boolean variable that is set once by isDebugEnabled(). Then you could say: private boolean debug = logger.isDebugEnabled(); In you method code you could say: if (debug) cat.debug(myObject.showState()); This would make it so that you only call isDebugEnabled() once in

Which Way of "Extending" Gives Fastest Performance

2004-04-22 Thread Robert Pepersack
Hi all. I'm considering wrapping or extending log4j. I've read this subject in Ceki's book and this user list, but I can't find a performance comparison. I believe Ceki's assertion that wrapping is the best and safest thing to do from a software engineering standpoint. But, my users and my

RE: Exception Quandry

2004-04-21 Thread Robert Pepersack
Hi Ken. > rare events. I surround my info and debug logging requests with "if" > blocks to prevent them from being executed. This isn't really necessary - just use the set the log level on the appender to ERROR or higher. However, you can still take a hit during creation of method parameters to

RE: Exception Quandry

2004-04-21 Thread Robert Pepersack
nce hit is. The most important performance consideration with logging is when you've got a lot of tracing calls and most of them are turned off most of the time. The system needs to realize this very quickly, as Log4j does. Mike -Original Message- From: Robert Pepersack [mailto:[EMAIL

Exception Quandry

2004-04-21 Thread Robert Pepersack
Hello. I have an exception that wraps other exceptions. I would like to log my own message and the message from the original exception's getMessage() method. I also want to log a system-generated exception ID that is created in the constructor of my wrapper exception. I want the log message

Info and Debug Class Variables

2004-04-20 Thread Robert Pepersack
Hi all. How should I declare class info and debug boolean variables? For example: private final boolean info = logger.isInfoEnabled(); // Use this in classes that have no superclasses or subclasses Should I declare them as static? What about inheritance situations. Thanks, Bob

Re: logging inside EJB

2004-04-19 Thread Robert Pepersack
Here's how I did it. // QueryBean.java package miaJ2ee.ejb.server; import java.util.ArrayList; import javax.ejb.SessionBean; import javax.ejb.SessionContext; import miaJ2ee.data.common.DataTransferObject; import miaJ2ee.ejb.client.QueryException; import miaJ2ee.dao.DataAccessObjectFactory; impo

Logger Wrapper That Translates SQLException

2004-04-16 Thread Robert Pepersack
Hi all. Has anyone written a Logger wrapper whose error() methods return a Throwable? I have a class that translates SQLExceptions into more generic exceptions, all of which extend a base exception class (e.g. StoredProcedureNotFoundException extends DataAccessException). I would like to hav

Re: Classpath in Win2K

2004-04-16 Thread Robert Pepersack
I use W2K and I've never run into this problem. What command are you using to set the classpath in the command window? You could try putting the commands in a batch file. If you're running it inside a server, then make sure that the log4j classes are in the server's classpath. Bob At 03:08