[ 
https://issues.apache.org/jira/browse/LOG4J2-1944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16307523#comment-16307523
 ] 

Mikael Ståldal edited comment on LOG4J2-1944 at 1/1/18 6:24 PM:
----------------------------------------------------------------

I see. So it is difficult to solve this issue as it is stated in the title 
(suppress the error message IF AND ONLY IF programmatic configuration API is 
used).

Maybe then a system property to suppress this error message would be 
appropriate? Users who wish to use only programmatic configuration (or who are 
happy with the default configuration) can set that property to avoid the 
misleading error message.

I think it is quite rare that users are happy with the default configuration 
though, and lack of and explicit configuration is a mistake most of the time. 
And if you are happy with something like the log4j-core default configuration, 
you could also exclude log4j-core and rely on {{SimpleLogger}} in log4j-api 
(although, there is a similar error message in that case, maybe there should be 
a way to suppress that as well?).


was (Author: mikaelstaldal):
I see. So it is difficult to solve this issue as it is stated in the title 
(suppress the error message IF AND ONLY IF programmatic configuration API is 
used).

Maybe then a system property to suppress this error message would be 
appropriate? Users who wish to use only programmatic configuration (or who are 
happy with the default configuration) can set that property to avoid the 
misleading error message.

I think it is quite rare that users are happy with the default configuration 
though, and lack of and explicit configuration is a mistake most of the time. 
And if you are happy with something like the log4j-core default configuration, 
you could also exclude log4j-core and rely on {{SimpleLogger}} in log4j-api 
(although, there is a similar error message in that case).

> Should suppress message "ERROR No log4j2 configuration file found..." when 
> programmatic API is used to config log4j.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1944
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1944
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Configurators
>    Affects Versions: 2.6.2
>            Reporter: Weian Deng
>            Priority: Minor
>         Attachments: LOG4J2-1944.patch, LOG4J2_1944.zip
>
>
> Log4j can be configured through log4j's configuration API.  There are cases 
> that an organization want to control the log4j configuration through the 
> configuration API and discourage the use of config file.  The error message
> {code}
> ERROR No log4j2 configuration file found. Using default configuration: 
> logging only errors to the console.
> {code}
> is misleading.  
> Can this be downgraded to WARN message, or provide a way to suppress it?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to