You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Oliver Ruebenacker <cu...@gmail.com> on 2012/09/26 15:51:56 UTC

log4j.xml problem

     Hello,

  It seems my log4j.xml file is loaded but has no effect (DEBUG level
is being logged although all levels in log4j.xml are WARN). It
produces these messages:

INFO: Initializing log4j from [classpath:log4j.xml]
log4j:WARN Continuable parsing error 93 and column 23
log4j:WARN The content of element type "log4j:configuration" must
match "(renderer*,appender*,(category|logger)*,root?,categoryFactory?)".
log4j:WARN Continuable parsing error 93 and column 23
log4j:WARN The content of element type "log4j:configuration" must
match "(renderer*,appender*,(category|logger)*,root?,categoryFactory?)".

  Looking at the file, I can't figure out why it causes these
messages. I attached the file. The position 93/23 is the end of the
last non-white line in the file, and the last lines are:

<root>
	<level value="WARN" />
	<appender-ref ref="stdout"/>
</root>

</log4j:configuration>

  I inherited a large JSF application, which I run on Tomcat 6 started
directly from Eclipse 3.7.2 (Indigo) workspace. Currently, an insane
amount of DEBUG-level messages from various libraries is deluging the
Eclipse console, making debugging extremely difficult and I suspect
also slow down the application and cause various problems for Eclipse.
A way to disable logging altogether would be a welcome stop-gap.

  Thanks!

     Take care
     Oliver

-- 
Scientific Developer at PanGenX (http://www.pangenx.com)

"Stagnation and the search for truth are always opposites." - Nadezhda
Tolokonnikova

Re: log4j.xml problem

Posted by Douglas E Wegscheid <Do...@whirlpool.com>.
that is correct. you should only see WARN on up. I verified it: this only 
logs the WARN when run against your log4j.xml.

import org.apache.log4j.Logger;
public class L {
  public static void main (String[] args) {
    Logger logger = Logger.getLogger(L.class);
    logger.info("info");
    logger.warn("warn");
  }
}

you can add debug="true" to the log4j:configuration element, that would 
give confirmation that the correct file is being parsed (though the parse 
messages going away kind of proves that anyway).

are you sure that all the debug messages are from log4j (or from the log4j 
instance that you are fiddling with)? A good way to check is to message 
with the layout and see if the log messages change when you change the 
layout....


■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER
(269) 923-5278 // Douglas_E_Wegscheid@whirlpool.com
"A wrong note played hesitatingly is a wrong note. A wrong note played 
with conviction is interpretation."

Oliver Ruebenacker <cu...@gmail.com> wrote on 09/26/2012 02:57:40 PM:

>   Thanks! That made the parse error messages disappear.
> 
>   Unfortunately, the file still seems to have no effect.
> 
>   Let me check whether I got that right:
> 
> <root>
>    <level value="WARN" />
>    <appender-ref ref="stdout"/>
> </root>
> 
>   I would assume that this sets log level to WARN for all code unless
> specified otherwise, right?

Re: log4j.xml problem

Posted by Oliver Ruebenacker <cu...@gmail.com>.
     Hello,

On Wed, Sep 26, 2012 at 2:46 PM, Douglas E Wegscheid
<Do...@whirlpool.com> wrote:
> at least one problem higher in the file (lines 27 and 31): too many XML
> comment closes (-->)

  Thanks! That made the parse error messages disappear.

  Unfortunately, the file still seems to have no effect.

  Let me check whether I got that right:

<root>
	<level value="WARN" />
	<appender-ref ref="stdout"/>
</root>

  I would assume that this sets log level to WARN for all code unless
specified otherwise, right?

> <!--  to see flow launches and resumes -->
> -->
> <logger name="org.springframework.faces.ui.WebFlowBoundaryComponent">
>         <level value="WARN" />
> </logger>
> -->
>
> good XML editor is recommended....

  I'm using the Eclipse text editor, which has some XML awareness
(some autocomplete and some warnings for broken XML). It actually did
display the extra closing tags in a different color, but raised no
warning, so I missed it. Eclipse also has an XML editor, but I find
the text editor easier to use for XML.

  Thanks!

     Take care
     Oliver

-- 
Scientific Developer at PanGenX (http://www.pangenx.com)

"Stagnation and the search for truth are always opposites." - Nadezhda
Tolokonnikova

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


Re: log4j.xml problem

Posted by Douglas E Wegscheid <Do...@whirlpool.com>.
at least one problem higher in the file (lines 27 and 31): too many XML 
comment closes (-->)

<!--  to see flow launches and resumes -->
-->
<logger name="org.springframework.faces.ui.WebFlowBoundaryComponent">
        <level value="WARN" />
</logger>
-->

good XML editor is recommended....

■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER
(269) 923-5278 // Douglas_E_Wegscheid@whirlpool.com
"A wrong note played hesitatingly is a wrong note. A wrong note played 
with conviction is interpretation."

Oliver Ruebenacker <cu...@gmail.com> wrote on 09/26/2012 01:39:17 PM:

>      Hello,
> 
>   Oops, sorry, I attached the wrong file. Attached is the right one.


Re: log4j.xml problem

Posted by Oliver Ruebenacker <cu...@gmail.com>.
     Hello,

  Oops, sorry, I attached the wrong file. Attached is the right one.

  Thanks!

     Take care
     Oliver

On Wed, Sep 26, 2012 at 12:44 PM, Douglas E Wegscheid
<Do...@whirlpool.com> wrote:
> be willing to look at it, but it looks like you attached your web.xml
> instead of the log4j.xml....
> ■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER
> (269) 923-5278 // Douglas_E_Wegscheid@whirlpool.com
> "A wrong note played hesitatingly is a wrong note. A wrong note played
> with conviction is interpretation."
>
> Oliver Ruebenacker <cu...@gmail.com> wrote on 09/26/2012 09:51:56 AM:
>
>>   Looking at the file, I can't figure out why it causes these
>> messages. I attached the file. The position 93/23 is the end of the
>> last non-white line in the file, and the last lines are:
>



-- 
Scientific Developer at PanGenX (http://www.pangenx.com)

"Stagnation and the search for truth are always opposites." - Nadezhda
Tolokonnikova

Re: log4j.xml problem

Posted by Douglas E Wegscheid <Do...@whirlpool.com>.
be willing to look at it, but it looks like you attached your web.xml 
instead of the log4j.xml....
■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER
(269) 923-5278 // Douglas_E_Wegscheid@whirlpool.com
"A wrong note played hesitatingly is a wrong note. A wrong note played 
with conviction is interpretation."

Oliver Ruebenacker <cu...@gmail.com> wrote on 09/26/2012 09:51:56 AM:

>   Looking at the file, I can't figure out why it causes these
> messages. I attached the file. The position 93/23 is the end of the
> last non-white line in the file, and the last lines are: