#4 config file fails on comments

open-accepted
None
5
2005-05-24
2004-02-09
Anonymous
No

Version: log4c-1.0.11
Compiled and run on: Linux 2.4.21-166-default (SuSE 9)
gcc version 3.3.1 (i586)

A ./log4crc file will not be correctly parsed if there
is a xml comment in it. The parsing will stop at the
first comment, ignoring further tags. Depending on
where your first comment is, you may get no output from
log4c. This happened with a comment after the <config>
element, and after a <category> element.

I believe that a comment causes the parser to reverse
the return code from somewhere in domnode-xml-parser.c,
as called by xml-domnode.c:xml_parse() line 111.
Without comments, the return code is 0, with comments
it seems to be 1.

Example:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE log4c SYSTEM "">

<log4c version="1.0.11">

<config>
<bufsize>0</bufsize>
<debug level="0"/>
<nocleanup>0</nocleanup>
</config>

<!-- this comment prevents the category from being
read/loaded -->
<category name="root" priority="info" appender="stdout"/>
</log4c>

Discussion

  • Cedric Le Goater

    • assigned_to: nobody --> legoater
     
  • Cedric Le Goater

    • status: open --> open-accepted
     
  • Vladimir Y. Kolundin

    Logged In: YES
    user_id=568275

    As far as I understand if I don't care of well-formness I
    can use '//' comments instead of standard ones.

    ... snip ...
    // this comment does not prevent the category from being
    read/loaded
    <category name="root" priority="info" appender="stdout"/>
    </log4c>

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks