bugzilla | 2 Oct 2005 23:08
Picon
Favicon

Bug report for Log4j [2005/10/02]

+---------------------------------------------------------------------------+
| Bugzilla Bug ID                                                           |
|     +---------------------------------------------------------------------+
|     | Status: UNC=Unconfirmed NEW=New         ASS=Assigned                |
|     |         OPN=Reopened    VER=Verified    (Skipped Closed/Resolved)   |
|     |   +-----------------------------------------------------------------+
|     |   | Severity: BLK=Blocker     CRI=Critical    MAJ=Major             |
|     |   |           MIN=Minor       NOR=Normal      ENH=Enhancement       |
|     |   |   +-------------------------------------------------------------+
|     |   |   | Date Posted                                                 |
|     |   |   |          +--------------------------------------------------+
|     |   |   |          | Description                                      |
|     |   |   |          |                                                  |
|  569|Ver|Cri|2001-02-09|fully qualified class name used as category name c|
|11512|New|Nor|2002-08-06|Chainsaw forces output of its internal messages to|
|13099|New|Nor|2002-09-27|DOMConfigurator ignores category factory setting  |
|14350|New|Enh|2002-11-07|Patch to substitute variables in the log4j.configu|
|15501|New|Nor|2002-12-18|FallbackErrorHandler throws NPW if no loggers are |
|15585|Ver|Maj|2002-12-20|log4j does not show Class Name, Method, or Line Nu|
|16280|New|Min|2003-01-21|Error Message always logged to log4j when calling |
|16922|New|Nor|2003-02-10|MDC with SMTPAppender doesn't work                |
|17498|New|Nor|2003-02-27|Logging inconsistencies using DailyRollingFileAppe|
|17507|Ass|Min|2003-02-27|Priority does not override hashCode() method      |
|17511|Opn|Enh|2003-02-28|Patch for Chainsaw to utilise Receiver framework  |
|17531|New|Min|2003-02-28|PropertyConfigurator.configureAndWatch() don't res|
|17862|New|Enh|2003-03-11|Version.getVersion() method requested             |
|18246|New|Enh|2003-03-22|Patch: Add more MDC support to XMLLayout and Patte|
|19796|New|Enh|2003-05-09|Would be nice to have RelativeTimeDateFormat avail|
|19902|New|Nor|2003-05-13|PropertyConfigurator throws ExceptionInInitializer|
|20395|New|Enh|2003-06-01|PreparedStatementAppender Enhancement             |
(Continue reading)

Andreas Fester | 2 Oct 2005 23:17
Picon
Picon

RollingFileAppender

Hi,

I played with the RollingFileAppender in log4j 1.3 today, mainly
because I started some work on the RollingFileAppender in log4cxx.
Just to be sure:

- The old RollingFileAppender (outside the rolling package)
   is not supported anymore, not even as a delegate to support
   the old property configuration?

- I tried to configure the new RollingFileAppender like

log4j.appender.testAppender=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.testAppender.triggeringPolicy=org.apache.log4j.rolling.SizeBasedTriggeringPolicy
log4j.appender.testAppender.file=RFA-test1.log

   but it seems that properties can still only be Strings, especially
   if their setter begins with "set" (there seems to be a similar
   mechanism for "add..." methods). Complex types (like layout)
   must be handled specially in the PropertyConfigurator?

   This again would mean that configuring the RollingFileAppender
   is not yet possible with the PropertyConfigurator?

   Would it be a proper solution to add special runtime instanciation
   of the triggeringPolicy class to the PropertyConfigurator, or is
   a smarter method intended (like looking for a setter which takes
   an Object, and trying to instanciate a class with the given property
   value)?

(Continue reading)

bugzilla | 2 Oct 2005 23:59
Picon
Favicon

DO NOT REPLY [Bug 36616] - log4j causes Tomcat redeploy to fail

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36616>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

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

------- Additional Comments From cowwoc <at> bbs.darktech.org  2005-10-02 23:59 -------
Excuse me, it's been over a month since this issue has been reported and I've
gotten no reply. Any there any plans for commiting this fix to 1.3?

--

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
Curt Arnold | 3 Oct 2005 02:23
Picon
Favicon

Re: RollingFileAppender


On Oct 2, 2005, at 4:17 PM, Andreas Fester wrote:

> Hi,
>
> I played with the RollingFileAppender in log4j 1.3 today, mainly
> because I started some work on the RollingFileAppender in log4cxx.
> Just to be sure:
>
> - The old RollingFileAppender (outside the rolling package)
>   is not supported anymore, not even as a delegate to support
>   the old property configuration?
>
>

The o.a.log4j.RollingFileAppender was removed from the CVS HEAD, but  
a delegating implementation was added back for compatibility with  
existing configuration files.  The delegating implementation has not  
appeared in any log4j 1.3 alpha release.  The delegating  
implementation is configuration compatible with the old  
implementation but user-supplied class that extended  
o.a.log4j.RollingFileAppender will likely fail to load and will  
surely not perform as expected.  The delegating implementation should  
be more robust that the log4j 1.2 implementation.  Not particularly  
happy with the situation, maybe should leave the old buggy o.a.l.RFA  
in the code for extension and have the configurators load a  
delegating RFA if it sees the old class name.

> - I tried to configure the new RollingFileAppender like
>
(Continue reading)

Andreas Fester | 3 Oct 2005 14:59
Picon
Picon

Re: RollingFileAppender

[...]
> That is my understanding.  I believe that filters are also not  
> configurable from property files.

Wouldnt it be useful to be able to do this?
The attached patch adds a mechanism to the PropertySetter which
tries to instanciate a class from the property value, if the parameter
of the setter is not a primitive type. With this patch, I was able
to configure the RollingFileAppender as follows:

log4j.appender.testAppender=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.testAppender.triggeringPolicy=org.apache.log4j.rolling.SizeBasedTriggeringPolicy
log4j.appender.testAppender.triggeringPolicy.maxFileSize=100
log4j.appender.testAppender.rollingPolicy=org.apache.log4j.rolling.FixedWindowRollingPolicy
log4j.appender.testAppender.rollingPolicy.fileNamePattern=RFA-test%i.log
log4j.appender.testAppender.rollingPolicy.activeFileName=RFA-test.log
log4j.appender.testAppender.Append=false
log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.testAppender.layout.ConversionPattern=%m\n

Drawback of my fast and dirty solution is that part of the
PropertyConfigurator behaviour is duplicated in the PropertySetter,
to allow configuring the sub component.

Regards,

	Andreas

--

-- 
Andreas Fester
(Continue reading)

Kelly Kerr | 3 Oct 2005 15:04
Picon

Kelly Kerr/Toronto/IBM is out of the office.

I will be out of the office starting  10/03/2005 and will not return until
10/07/2005.

I will respond to your message when I return.
SD | 3 Oct 2005 23:27

HTMLLayout.java Patch

Patch for HTMLLayout.java to allow the user of the logger to turn the html header/footer off if needed.

I'm using log4j to output some html but I'm doing this within an existing webpage.  Therefore, I don't need/want the html header/footer that the logger normally prints out.
Added the member var shouldWriteHtmlHeaderAndFooter and the appropriate if statements to make the desired effect.  Also added an assessor and setter for shouldWriteHtmlHeaderAndFooter.


Thanx for the awesome logging lib.

Index: HTMLLayout.java
===================================================================
RCS file: /home/cvspublic/logging-log4j/src/java/org/apache/log4j/html/HTMLLayout.java,v
retrieving revision 1.7
diff -u -r1.7 HTMLLayout.java
--- HTMLLayout.java        22 May 2005 07:56:22 -0000      1.7
+++ HTMLLayout.java  3 Oct 2005 20:42:58 -0000
<at> <at> -66,6 +66,7 <at> <at>
   private FormattingInfo[] patternFields;
   private String timezone;
   private String title = "Log4J Log Messages";
+  private boolean shouldWriteHtmlHeaderAndFooter = true;
 
   private boolean internalCSS = false;
   private String url2ExternalCSS = "http://logging.apache.org/log4j/docs/css/eventTable-1.0.css";
<at> <at> -109,6 +110,16 <at> <at>
   public String getConversionPattern() {
     return pattern;
   }

+  public boolean shouldWriteHtmlHeaderAndFooter()
+  {
+return shouldWriteHtmlHeaderAndFooter;
+  }

+  public void setShouldWriteHtmlHeaderAndFooter(boolean shouldWriteHtmlHeaderAndFooter)
+  {
+       this.shouldWriteHtmlHeaderAndFooter = shouldWriteHtmlHeaderAndFooter;
+  }
 
   /**
    * Does not do anything as options become effective
<at> <at> -236,28 +247,31 <at> <at>
    */
   public String getHeader() {
     StringBuffer sbuf = new StringBuffer();
-    sbuf.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"");
-    sbuf.append(" \"http://www.w3.org/TR/html4/loose.dtd\">");
-    sbuf.append(Layout.LINE_SEP);
-    sbuf.append("<html>");
-    sbuf.append(Layout.LINE_SEP);
-    sbuf.append("<head>");
-    sbuf.append(Layout.LINE_SEP);
-    sbuf.append("<title>" + title + "</title>");
-    sbuf.append(Layout.LINE_SEP);
-    if(internalCSS) {
-      getInternalCSS(sbuf);
-    } else {
-      sbuf.append("<LINK REL=StyleSheet HREF=\""+url2ExternalCSS+"\" TITLE=\"Basic\">");
-    }
-    sbuf.append(Layout.LINE_SEP);
-    sbuf.append("</head>");
-    sbuf.append(Layout.LINE_SEP);
-    sbuf.append("<body>");
-    sbuf.append(Layout.LINE_SEP);
-   
-    sbuf.append("<hr size=\"1\" noshade>");
-    sbuf.append(Layout.LINE_SEP);
+    if(shouldWriteHtmlHeaderAndFooter)
+    {
+             sbuf.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"");
+              sbuf.append(" \"http://www.w3.org/TR/html4/loose.dtd\">");
+            sbuf.append(Layout.LINE_SEP);
+        sbuf.append("<html>");
+                sbuf.append(Layout.LINE_SEP);
+        sbuf.append("<head>");
+                sbuf.append(Layout.LINE_SEP);
+        sbuf.append("<title>" + title + "</title>");
+          sbuf.append(Layout.LINE_SEP);
+        if(internalCSS) {
+                     getInternalCSS(sbuf);
+          } else {
+                      sbuf.append("<LINK REL=StyleSheet HREF=\""+url2ExternalCSS+"\" TITLE=\"Basic\">");
+             }
+             sbuf.append(Layout.LINE_SEP);
+        sbuf.append("</head>");
+               sbuf.append(Layout.LINE_SEP);
+        sbuf.append("<body>");
+                sbuf.append(Layout.LINE_SEP);
+       
+               sbuf.append("<hr size=\"1\" noshade>");
+               sbuf.append(Layout.LINE_SEP);
+ }
    
     sbuf.append("Log session start time " + new java.util.Date() + "<br>");
     sbuf.append(Layout.LINE_SEP);
<at> <at> -290,9 +304,12 <at> <at>
   public String getFooter() {
     StringBuffer sbuf = new StringBuffer();
     sbuf.append("</table>" + Layout.LINE_SEP);
-    sbuf.append("<br>" + Layout.LINE_SEP);
-    sbuf.append("</body></html>");
-    return sbuf.toString();
+    if(shouldWriteHtmlHeaderAndFooter)
+    {
+             sbuf.append("<br>" + Layout.LINE_SEP);
+        sbuf.append("</body></html>");
+    }
+   return sbuf.toString();
   }
 
   /**

-- --
==========================================
SD

WARNING: Programming may be habit forming.
Peter | 4 Oct 2005 02:10
Picon
Favicon

ThrowableInformation.getThrowableStrRep()

Hi,

I'm curious, why does
ThrowableInformation.getThrowableStrRep() clone the
string representation before returning? This is adds
significant overhead for events with long stacktraces
and is done of course for every serialization.

Thanks,
Peter
Mark Womack | 4 Oct 2005 02:57
Picon
Favicon

Re: HTMLLayout.java Patch

Hi,

Would it be possible for you to submit this patch into Bugzilla?  That way we won't lose track of it.  I would imagine that we can include this or something like it in the 1.3 release.

thanks for the submission!
-Mark

On 10/3/05, SD <log4j <at> fishh2o.com> wrote:
Patch for HTMLLayout.java to allow the user of the logger to turn the html header/footer off if needed.

I'm using log4j to output some html but I'm doing this within an existing webpage.  Therefore, I don't need/want the html header/footer that the logger normally prints out.
Added the member var shouldWriteHtmlHeaderAndFooter and the appropriate if statements to make the desired effect.  Also added an assessor and setter for shouldWriteHtmlHeaderAndFooter.


Thanx for the awesome logging lib.

Scott Deboy | 5 Oct 2005 17:36

RE: PropertyConfigurator.configureAndWatch

We can't remove the api without deprecating it 1st, so log4j 1.3 should
support the configureandwatch methods.

Is the plan to have domconfigurator.configureandwatch (and
propertyconfigurator?) leverage a watchdog?  I thought we had discussed
this before but don't see it in the mailing list archive.

Scott

-----Original Message-----
From: Jacob Kjome [mailto:hoju <at> visi.com] 
Sent: Wednesday, October 05, 2005 8:19 AM
To: Log4J Users List
Subject: Re: PropertyConfigurator.configureAndWatch

Quoting "Boddapati, Vijaya" <Vijaya.Boddapati <at> ibx.com>:

> Hi,
>  I have downloaded the latest version of log4j(1.3 alpha). But I could

> not locate the method configureAndWatch in PropertyConfigurator class.
> Please point me to the exact class.
>

configureAndWatch() has been removed in Log4j-1.3.  It is also not
recommended to use this in Log4j-1.2 either if you are running in a J2EE
environment.

I believe Mark Womack was working on File Watchdogs and such, but I
can't quite recall where he was with all that?  Mark, can you comment?

Jake

> Thanks
> Vijaya

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe <at> logging.apache.org
For additional commands, e-mail: log4j-user-help <at> logging.apache.org

Gmane