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

Ralph Goers edited comment on LOG4J2-905 at 8/18/16 5:39 PM:
-------------------------------------------------------------

IMO, the correct solution is to add an option to %msg such as %msg\{raw} or 
%msg\{nosubst}.  It would be very easy to just use that to set a boolean value 
to check in MessagePatternConverter so that instead of 

{code}
  if (config != null) {
{code}

we do 

{code}
  if (config != null && isSubstitution) {
{code}

Then the user could control the behavior by specifying the converter option 
that disables it.  Note that by combing this with PatternSelectors they could 
enable this just for events from Camel's loggers and leave it enabled for 
others.


was (Author: ralph.go...@dslextreme.com):
IMO, the correct solution is to add an option to %msg such as %msg{raw} or 
%msg{nosubst}.  It would be very easy to just use that to set a boolean value 
to check in MessagePatternConverter so that instead of 

{code}
  if (config != null) {
{code}

we do 

{code}
  if (config != null && isSubstitution) {
{code}

Then the user could control the behavior by specifying the converter option 
that disables it.  Note that by combing this with PatternSelectors they could 
enable this just for events from Camel's loggers and leave it enabled for 
others.

> Ability to disable (date) lookup completely, compatibility issues with other 
> libraries like camel
> -------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-905
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-905
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Lookups
>            Reporter: moritz löser
>            Priority: Critical
>              Labels: date, lookup
>
> (see 
> [here|http://stackoverflow.com/questions/27103400/log4j2-how-to-disable-date-lookup-log4j-throws-exception]
>  for some details )
> At the moment it is not possible to log stuff like this:
> {noformat}
> log.info("${date:now:buhu}");
> {noformat}
> ("ERROR Invalid date format: "now:yyyyMMdd-HHmmss", using default 
> java.lang.IllegalArgumentException: Illegal pattern character 'n'")
> Because log4j2 tries to change the logged output - want to substitute a date. 
> This is intransparently limiting the logging. 
> nobody knows what kind of strings are allowed and what kind of strings will 
> be interpreted by log4j2. But it becomes worse if you use slf4j and switch 
> the logger implementation to log4j2 - it could happen that just switching 
> breaks your code.
> This is a *real issue* if you use libraries like *apache camel* because camel 
> itself uses strings like {noformat}${date:now:YYYY...}{noformat} to 
> substitute stuff like file names. see http://camel.apache.org/simple.html
> At the moment camel is logging this stuff on debug (sometime i need it to see 
> if i correctly set up camel) so it is no production issue here. But what 
> about other libraries or the future?
> The only way i see is a switch to disable all kinds of lookups and it should 
> probably off by default.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to