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

appenders must inject exception stacktraces if the layout ignores them #1

Open
kortemik opened this issue Sep 2, 2021 · 0 comments

Comments

@kortemik
Copy link
Member

kortemik commented Sep 2, 2021

Using following kind of EnhancedPatternLayout will skip exception stacktraces

<layout class="org.apache.log4j.EnhancedPatternLayout">
  <param name="ConversionPattern" value="%d{​​​​​​​​​​​​yyyy-MM-dd HH🇲🇲ss.SSS}​​​​​​​​​​​​​​​​​​​ %-5p [%t][%c{​​​​​​​​​​​​​​​​​​​1}​​​​​​​​​​​​​​​​​​​:%L] %m%n" />
</layout>

Using XMLLayout includes them, propably handled there.

<layout class="org.apache.log4j.xml.XMLLayout">
  <param name="LocationInfo" value="true" />
</layout>

Changing EnhancedPatternLayout to use pattern that includes them successfully shows exception stacktraces too:

<layout class="org.apache.log4j.EnhancedPatternLayout">
  <param name="ConversionPattern" value="%d{​​​​​​​​​​​​​​​​​​​yyyy-MM-dd HH:mm:ss.SSS}​​​​​​​​​​​​​​​​​​​ %-5p [%t][%c{​​​​​​​​​​​​​​​​​​​1}​​​​​​​​​​​​​​​​​​​:%L] %m%n%throwable%n" />
</layout>

Meaning we must change the appender to inject them as with the default appenders:
http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/WriterAppender.java?view=markup#l313

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

1 participant