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

[LOGBACK-540] Filtering out selected stack trace frames #244

Merged
merged 1 commit into from Mar 1, 2015

Conversation

@nurkiewicz
Copy link
Member

nurkiewicz commented Feb 24, 2015

This PR adds capability of filtering selected stack frames if it's decided that they are irrelevant. You can use it by defining patterns that, if are contained within stack line, suppress displaying it:

<property name="ignored" value="
  AbstractPlainSocketImpl,
  sun.net.www.http.HttpClient,
  sun.net.www.protocol.http.HttpURLConnection.connect
"/>

<!-- and later: -->
<pattern>%d{HH:mm:ss.SSS} | %m%n%rEx{full,${ignored}}</pattern>

<!-- or directly: -->
<pattern>%d{HH:mm:ss.SSS} | %m%n%rEx{full,AbstractPlainSocketImpl,
  sun.net.www.http.HttpClient,
  sun.net.www.protocol.http.HttpURLConnection.connect}</pattern>

If some stack lines were ignored while showing stack trace, small indicator tells how many lines were skipped:

java.net.UnknownHostException: sopsdsfjdskjfskjfdskj.com
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_31] [1 skipped]
    at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_31]
    at java.net.Socket.connect(Socket.java:538) ~[na:1.8.0_31]
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180) ~[na:1.8.0_31]
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1168) ~[na:1.8.0_31] [5 skipped]
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1104) ~[na:1.8.0_31]
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:998) ~[na:1.8.0_31]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512) ~[na:1.8.0_31] [1 skipped]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440) ~[na:1.8.0_31]
    at Foo.main(Foo.java:12) ~[test-classes/:na]

Issues is discussed in [LOGBACK-540] and further discussed here: Filtering irrelevant stack trace lines in logs

@tony19

This comment has been minimized.

Copy link
Member

tony19 commented Feb 25, 2015

Thanks for the contribution, @nurkiewicz. Please add a comment here with release notes (see rule P7 of CONTRIBUTING.md).

@nurkiewicz nurkiewicz force-pushed the nurkiewicz:LBCLASSIC-325 branch from e231380 to a71b290 Feb 28, 2015
@nurkiewicz

This comment has been minimized.

Copy link
Member Author

nurkiewicz commented Mar 1, 2015

Thanks @tony19 for review, fixed. Release notes comment:

<p>Irrelevant or internal stack trace lines can now be omitted. Pull request provided by
    Tomasz Nurkiewicz (<a href="http://jira.qos.ch/browse/LOGBACK-540">LOGBACK-540</a>).
</p>
tony19 added a commit that referenced this pull request Mar 1, 2015
[LOGBACK-540] Filtering out selected stack trace frames
@tony19 tony19 merged commit 6905910 into qos-ch:master Mar 1, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
tony19 added a commit that referenced this pull request Mar 1, 2015
@tony19

This comment has been minimized.

Copy link
Member

tony19 commented Mar 1, 2015

@nurkiewicz, please also update the docs to indicate this new feature. Thanks

@nurkiewicz

This comment has been minimized.

Copy link
Member Author

nurkiewicz commented Mar 1, 2015

Thanks, I'm about to leave for vacation for two weeks, will do a separate PR with documentation changes after that.

@DanielJonesEB

This comment has been minimized.

Copy link

DanielJonesEB commented Jul 21, 2015

@nurkiewicz Did you get a chance to raise the documentation PR? I had a quick look for it, but couldn't find it. I'm having difficulty getting the cool new functionality to work.

@nurkiewicz

This comment has been minimized.

Copy link
Member Author

nurkiewicz commented Jul 21, 2015

No, sorry. I will document this feature within next few days. In the meantime feel free to reach me directly, I'll try to help.

@DanielJonesEB

This comment has been minimized.

Copy link

DanielJonesEB commented Jul 22, 2015

@nurkiewicz Ah, turns out it was a PEBKAC issue! All working splendidly now. Thanks very much, this feature is helping me mitigate a production log velocity issue.

@redron

This comment has been minimized.

Copy link

redron commented Jan 28, 2016

Hi,
I am trying to combine this feature with replace statement:
%replace(%ex{full, org.springframework}){'\n', '|||'}%nopex
and it seems that there is no support of such an expressions yet. I wasn't able to find any workarounds so far.
Can you please advice on it?
Thanks.

@ndjensen

This comment has been minimized.

Copy link

ndjensen commented Jul 13, 2016

Is this going to be documented in the layouts page of the guide?

Also it doesn't seem to work well when using logback's colors for patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.