Uploaded image for project: 'JBoss Log Manager'
  1. JBoss Log Manager
  2. LOGMGR-104

SyslogHandler doesn't handle multi-byte characters correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.5.3.Final, 2.0.0.Beta1
    • 1.5.2.Final
    • core
    • None

      SyslogHandler doesn't handle multi-byte characters correctly.

      I tried to log multi-byte message with both of org.jboss.logmanager.handlers.SyslogHandler and org.apache.log4j.net.SyslogAppender for same message, only SyslogHandler output were corrupted.

      Step to reproduce (It might need to define -Dfile.encoding=UTF-8 in _JAVA_OPTIONS):

      1. define a facility local1 at localhost and make syslog accept UDP packets.
      2. define a logger:

      /subsystem=logging/logger=utf8mb4log:add(level=INFO)
      

      3. define a SyslogHandler:

      /subsystem=logging/custom-handler=TEST_SH:add(class="org.jboss.logmanager.handlers.SyslogHandler", module="org.jboss.logmanager", formatter="SyslogHandler: %s%e", level=INFO, properties={serverHostname="localhost:514", facility="LOCAL_USE_1", truncate=false, maxLength=1024, syslogType="RFC3164" })
      /subsystem=logging/logger=utf8mb4log:assign-handler(name=TEST_SH)
      

      4. define a SyslogAppender:

      /subsystem=logging/custom-handler=TEST_LOG4J:add(class="org.apache.log4j.net.SyslogAppender", module="org.apache.log4j", formatter="log4j: %s%e", level=INFO, properties={syslogHost="localhost:514", facility="local1"})
      /subsystem=logging/logger=utf8mb4log:assign-handler(name=TEST_LOG4J)
      

      5. get and deploy example project at https://github.com/lbtc-xxx/utf8mb4log
      6. Access the servlet http://localhost:8080/utf8mb4log/

      And you will get like this: (I can't put 4 byte UTF-8 characters here... because database error occured):

      Mar  8 17:29:09 UNKNOWN_HOSTNAME java[9896]: SyslogHandler: ????????????
      

      I would send a pull request later.

        1. corrupted2.png
          corrupted2.png
          41 kB
        2. corrupted3.png
          corrupted3.png
          42 kB
        3. corrupted.png
          corrupted.png
          43 kB

              jperkins-rhn James Perkins
              xkylex Kohei Nozaki (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: