[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-user
Subject:    Excessive number of blank lines being logged in blocks by org.apache.tomcat.util.digester.Digester
From:       Polina Genova <polina.genova () gmail ! com>
Date:       2015-03-30 7:27:58
Message-ID: CAJuoQU3k44xrozCxK43siZETf5QdYCB748nk8C1r-pWi_m2GuA () mail ! gmail ! com
[Download RAW message or body]


Hi,



Recently I came across an issue with excessive number of blocks of blank
lines being logged in the catalina output logs.

This is easily reproducible by simply starting a clean Tomcat 7.0.59 server
with enabled the following logger configuration

org.apache.tomcat.util.digester.Digester.level = FINEST

The result is enormous catalina log file containing plenty of logs like the
following:

--------------------------------------------------------------

Mar 26, 2015 6:12:48 PM org.apache.tomcat.util.digester.Digester
startElement

FINE:   Pushing body text '







  '

Mar 26, 2015 6:12:48 PM org.apache.tomcat.util.digester.Digester endElement

FINE:   Popping body text '







  '

--------------------------------------------------------------

The number of empty lines increases up to hundreds in a single log message.

Actually this depends on the number of new lines being accumulated so far
for the surrounding xml element of the currently processed one.

For example when processing the default global server.xml, on invocation of
the startElement and stopElement of each inner element

the surrounding ‘Server' element's accumulated body is being logged and it
consists only of new lines, i.e. no meaningful content.

As the logged information can bring such a large blocks of empty lines and
no valuable information, I'd like to propose these debug messages to be
removed.

Can you think of a specific reason to preserve them?



Here's a patch:

--- Digester.java               (revision 1669608)

+++ Digester.java            (working copy)

@@ -1047,9 +1047,6 @@



         // Recover the body text from the surrounding element

         bodyText = bodyTexts.pop();

-        if (debug) {

-            log.debug("  Popping body text '" + bodyText.toString() + "'");

-        }



         // Fire "end" events for all relevant rules in reverse order

         if (rules != null) {

@@ -1252,9 +1249,7 @@



         // Save the body text accumulated for our surrounding element

         bodyTexts.push(bodyText);

-        if (debug) {

-            log.debug("  Pushing body text '" + bodyText.toString() + "'");

-        }



On a closer look of the Digester class, it seems that the whole structure
of previously accumulated bodyTexts could be removed, for the bodyText
values being pushed and popped from it

are used only in the mentioned debug messages.

So what do you think is the better approach?



Thanks and regards,

Polina


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic