0

I have a project in IntelliJ where I have imported JBoss Logging via a Maven library.

Maven:org.jboss.logging:jboss-logging:3.3.1.Final

I have created a logger for my class.

private final Logger LOG = Logger.getLogger(MyClass.class.getName());

And then I log some info messages.

LOG.info("some info here");

Everything is printed to the console and seem to be working as it should. Except the fact that everything is red, the same red as errors in intelliJ. I am guessing this is because the logger is sending to System.error instead of System.out. Regular System.out.print() is the standard light grey color.

I have tried finding out how to configure this setting for the logger, but no online resource seems to know how. I might have missed something, I have been at this for a while now. Hopefully someone here knows the solution.

Skillzore
  • 748
  • 7
  • 21
  • Which logger? Log4J version 1 or 2? SLF4J? You need more: http://docs.jboss.org/hibernate/orm/4.3/topical/html/logging/Logging – duffymo Feb 06 '18 at 15:46
  • @duffymo No idea, the Maven library I have, have both those and this Logger class I am using. No idea which one it implements in the background. – Skillzore Feb 06 '18 at 15:48
  • It's bad to have no idea. Pick one. Add log4j version 1 to your Maven dependencies and create a log4j.xml configuration. See if that helps. – duffymo Feb 06 '18 at 15:49
  • @duffymo You misunderstand, the maven dependecy on Jboss-logging that I have, have Log4J 1 and 2 and SLF4J aswell as a class called Logger, which is the one I use. What the Logger class uses in the background, if it uses any of them, I have no idea. I could of course directly use any of the other if they are easier to configure to help my issue. – Skillzore Feb 06 '18 at 15:53
  • I do understand: I use JBOSS. I think Logger is a wrapper around the one you choose to use. I happen to use Log4J version 1. You have to tell JBOSS which one you want to use. – duffymo Feb 06 '18 at 16:12
  • jboss-logging is just a logging facade like slf4j. It doesn't write anything directly to the console so it's has to be picking up some log manager. – James R. Perkins Feb 07 '18 at 00:46
  • @duffymo Well I have not told it anything. Just used it as stated in my question. So, what is the default behavior of the `Logger` class? I have yet to find any helpful information on the jBoss logging. – Skillzore Feb 07 '18 at 09:20
  • @JamesR.Perkins Sure, but which one? How do I configure it? I have not found any helpful resource in my searches. – Skillzore Feb 07 '18 at 09:21
  • I don't know which log manager is being used. Are you running in a container? Just a main method, etc? – James R. Perkins Feb 08 '18 at 14:39
  • I actually came across this today myself and looked at the `java.util.logging.ConsoleHandler`. It defaults to writing to `System.err` which is why IDEA is doing that. – James R. Perkins Feb 08 '18 at 23:53
  • @JamesR.Perkins Sorry, for not responding! Exactly, can we change this? If so, where and how? This is the answer I am looking for, if anyone knows, please write an answer. – Skillzore Feb 26 '18 at 13:32
  • You'd probably have to either supply your own `logging.properties` for IDEA or you'd need to edit your `$JAVA_HOME/jre/lib/logging.properties`. – James R. Perkins Feb 26 '18 at 17:29
  • @JamesR.Perkins `$JAVA_HOME/jre/lib/logging.properties` does not seem to have a setting for this. Is it something I can add manually or is it located somewhere else? What would be the variable name that needs to be set to `System.out` instead of `System.err`? – Skillzore Mar 06 '18 at 12:34
  • I guess it's not changeable https://docs.oracle.com/javase/8/docs/api/java/util/logging/ConsoleHandler.html. – James R. Perkins Mar 07 '18 at 16:58
  • @JamesR.Perkins Well, then we know! Write an answer if you want the rep :) – Skillzore Mar 09 '18 at 09:13

0 Answers0