amittel
amittel

Reputation: 1

Netbeans 16 with Glassfish 6 shows incorrect log4j2 output

Netbeans does not display log4j2 messages correct in the Glassfish Server Output window. But if I look at the glassfish server log, everthing is displayed correctly.

In my controller I have the following

System.out.println("This is a debug messages!\n\tWith new line and tab.");
LOG.debug("This is a debug messages!\n\tWith new line and tab.");

When I run my app I get the following in my output window in Netbeans

 This is a debug messages!
    With new line and tab.|#]  <-- System.out.println
    With new line and tab.     <-- LOG.debug
|#]

But looking in the server log everything is looking fine

[2023-03-30T17:17:02.256+0200] [glassfish 6.2] [INFO] [] [] [tid: _ThreadID=187 _ThreadName=Thread-7] [timeMillis: 1680189422256] [levelValue: 800] [[
  This is a debug messages!
    With new line and tab.]]

[2023-03-30T17:17:02.483+0200] [glassfish 6.2] [INFO] [] [] [tid: _ThreadID=187 _ThreadName=Thread-7] [timeMillis: 1680189422483] [levelValue: 800] [[
  17:17:02.393 [RoomController] DEBUG - This is a debug messages!
    With new line and tab.
]]

log4j2.xml in WEB-INF

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%c{1}] %-5level - %msg%n"/>
        </Console>

    </Appenders>
    <Loggers>
        <Root level="DEBUG">
            <AppenderRef ref="Console"/>
        </Root>
    </Loggers>
</Configuration>

I am using

Glassfish 6.2.5
NetBeans 16
Log4j2 2.20.0

I could not find any setting to tweak. Is there another way in netbeans to display glassfish log messages?


Other questions found on same topic:

Upvotes: 0

Views: 94

Answers (0)

Related Questions