application logging

72 views
Skip to first unread message

Rusty Wright (Lumpynose)

unread,
Sep 24, 2023, 12:58:25 PM9/24/23
to WildFly
WildFly 29.0.1, java 17, Eclipse 2023-09

Jakarta EE and JSF newbie here.  My pom.xml is using the dependency jakarta.platform:jakarta.jakartaee-api:10.0.0.

I'm using wildfly inside of eclipse only.  In my pom.xml I added a dependency for org.slf4j:slf4j-api:2.0.9 (nothing more for slf4j).

The logging for wildfly is set to INFO so none of my log.debug() calls were showing up in eclipse's console.  I edited the standalone.xml file in \standalone\configuration in the folder that I extracted wildfly in and added

    <logger category="org.objecteffects">
        <level name="DEBUG"/>
    </logger>

for my application.  Restarted wildfly and my log statements showed up. I added another log.debug and restarted and now my log.debug statements aren't showing?

What happened and how can I get it to show my log.debugs?

 

James Perkins

unread,
Sep 24, 2023, 1:03:26 PM9/24/23
to WildFly
Are you including slf4j in your deployment? If so, you shouldn't need to do that. You should also consider using CLI or the web console to configure logging. If you modify logging with one of those options there is no requirement to restart WildFly.

Rusty Wright (Lumpynose)

unread,
Sep 24, 2023, 1:14:42 PM9/24/23
to WildFly
Thinking about it, I'm not sure I did enough mumbo-jumbo after I made the change to standalone.xml.  Eclipse doesn't seem to always get or see changes so I do a project clean as well as a server clean and hopefully it will update things.  After changing standalone.xml I changed all of my existing log.info()s to log.debug() but in the console output it was still showing them as log.info() which I thought was odd.  I assumed that wildfly was mapping my log.debugs to log.info but now suspect that it just didn't "take".

So I guess my question now is how can I use log.debug in my app?

Rusty Wright (Lumpynose)

unread,
Sep 24, 2023, 2:07:08 PM9/24/23
to WildFly
I was only using org.slf4j:slf4j-api:2.0.9  in my pom.xml dependencies.  After posting this I added the dependency org.slf4j:slf4j-log4j12:2.0.9.  That didn't help.

Rusty Wright (Lumpynose)

unread,
Sep 24, 2023, 2:10:59 PM9/24/23
to WildFly
Thanks, my mistake; I was including slf4j.  I commented that out from my pom and now I'm getting a different error ...

On Sunday, September 24, 2023 at 10:03:26 AM UTC-7 James Perkins wrote:

Rusty Wright (Lumpynose)

unread,
Sep 24, 2023, 2:33:35 PM9/24/23
to WildFly
After deleting the slf4j stuff from my pom.xml and doing everything from this page, I got it to work.  (Thanks James Perkins.)


Is mastertheboss.com a good place with correct information?

James Perkins

unread,
Sep 25, 2023, 12:15:38 PM9/25/23
to WildFly
That is a good place for information. That said, that article is about using logback with WildFly. If you want to just use slf4j there is nothing you should be required to do. The fact you were not seeing debug messages on the console is likely because the console is set to show INFO and higher only. You'd need to make change there too. Something like the following in CLI:

/subsystem=logging/console-handler=CONSOLE:undefine-attribute(name=level)

Reply all
Reply to author
Forward
0 new messages