Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1107

Socket Appender sends incorrect log

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.1.3
    • logback-core
    • Windows 7/ Spring tool suits

    Description

      We send some log using socket appender. If socket server dont have any idea of data it will receive, it will be reading additional characters apart from log msg. Reason is socket appender uses objectOutputStream and this stream adds addiotnal information like, msg length, with msg.

      for example , msg: "hi there" [assume no contextual information]. sent by socket appender. what I receive at socket server : ��hi there (some special characters are added at start of message)

      It will be a major issue if log message in itself is some command to be executed at server end. This issue seems to more related with objectOutputStream. So Here, I would suggest to provide one of the options: either replace ObjectOutputStream with Data or BufferedOutput Stream and send byte array instead. Now only exact message will be sent. Or give developer flexibility to define his/her own output stream. As of now, methods are private.

      To reproduce: (all codes in java, u can prefer your own)
      1. Write very simple socket server, which read coming message char by char and halts if new line or EOF found. Store these char reads in byte array and print string of it.
      3. Configure Socket Appender in standalone app.
      4. send some logs. You will see some special characters added at starting of log being sent.
      (to avoid contextual information from log, like Logger name, date, I would suggest to extend Socket Appender class and override getPST() method with returning message only)

      Attachments

        Activity

          People

            logback-dev Logback dev list
            hitman Pushpendra Patel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: