Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug Messages on console #268

Closed
RajeshJangra opened this issue Nov 21, 2019 · 7 comments
Closed

Debug Messages on console #268

RajeshJangra opened this issue Nov 21, 2019 · 7 comments

Comments

@RajeshJangra
Copy link

Arch unit is printing a lot of debug messages on console. How could I stop them from printing on console.

23:25:19.247 [main] DEBUG com.tngtech.archunit.core.importer.JavaClassProcessor - Analysing method java.lang.reflect.Executable.sharedToGenericString:(IZ)Ljava/lang/String; 23:25:19.247 [main] DEBUG com.tngtech.archunit.core.importer.JavaClassProcessor - Analysing method java.lang.reflect.Executable.specificToGenericStringHeader:(Ljava/lang/StringBuilder;)V 23:25:19.247 [main] DEBUG com.tngtech.archunit.core.importer.JavaClassProcessor - Analysing method java.lang.reflect.Executable.getDeclaringClass:()Ljava/lang/Class; 23:25:19.247 [main] DEBUG com.tngtech.archunit.core.importer.JavaClassProcessor - Analysing method java.lang.reflect.Executable.getName:()Ljava/lang/String;

@hankem
Copy link
Member

hankem commented Nov 22, 2019

Can you disable logging at DEBUG level?

@RajeshJangra
Copy link
Author

The issue seems to be in our application. I am closing the issue.

@tom-mi
Copy link

tom-mi commented Jan 31, 2020

I'm also affected by this. Usually in tests I prefer debug log level for obvious reasons.
IMHO, the log messages mentioned in the above example however should be classified as TRACE logs. As a user of a test framework, I'm usually not interested in the internals in that level of granularity.

@codecholeric
Copy link
Collaborator

@tom-mi are you on the most recent version of ArchUnit? A lot of the output has been changed from DEBUG to TRACE.
I agree that as a user you might not be interested in the level of details that ArchUnit logs on DEBUG or TRACE, but I would argue that as a user you also don't have to configure the logger of the framework itself to log on DEBUG if you don't like the granularity, do you? 🤔
You know that you can simply turn down the log level of specific classes you're not interested in, like the importer classes, right? Simply configuring com.tngtech.archunit to log on INFO or WARN would relieve you of all those ArchUnit details while keeping all your app logs the way they were.

@hankem
Copy link
Member

hankem commented Jan 31, 2020

For refrence: This was changed with #291.

@nbrugger-tgm
Copy link

Can you disable logging at DEBUG level?

I tried it several ways but i didn't managed to get rid of the messages, sadly.

  1. Using -Dlogging.level.root=INFO
  2. Using logging.level.root=INFO in slf4j.properties in class path
  3. passing logging.level.root=INFO as environment variable

My testing environment is plain JUnit5 so there is no custom spring-config going on to load a application.properties. I have like ~20+ ArchTest classes and i want to avoid to programmatically set the level using a @Before to each class (redundant and error prone etc)

@codecholeric
Copy link
Collaborator

But if you see DEBUG log output you must pull in some config for the respective log framework? Is this a Spring project? If yes, what logging framework are you using? Logback? Maybe check the dependencies via Maven or Gradle to see what SLF4J-Binding you have... Then when you know which framework you pull in you can probably find out how to disable the logging for this framework (or how to debug from where the config is pulled in)
But I think you must pull in a config for your respective logging framework from somewhere, otherwise DEBUG (or in fact all logging if you wouldn't pull in any SLF4J binding) would be disabled...

electronickai pushed a commit to electronickai/ensure-functional-core that referenced this issue Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants