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

Multi-line logs - stacktraces and others #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

welcor
Copy link

@welcor welcor commented Jan 23, 2017

When a log event results in a multi-line output, papertrails will receive them as one line with correct source and application, and the following lines without correct hostname.

This results in output looking like this:

Jan 23 16:04:56 193.213.209.1 advisoradmin-server: INFO o.h.jpa.internal.util.LogHelper:	HHH000204: Processing PersistenceUnitInfo [
Jan 23 16:04:56 193.213.209.1 logger: 	name: default
Jan 23 16:04:56 193.213.209.1 logger: 	...]

This occurs due to papertrails not handling the newlines as part of the same message. In practice this means that filtering on hostname filters out the corresponding lines from the log(!)

If, instead, we send the lines separately when logging on different lines, the lines will all contain the hostname.
With this patch, the resulting output looks like this:

Jan 23 16:17:01 193.213.209.1 advisoradmin-server: INFO  o.h.jpa.internal.util.LogHelper: HHH000204: Processing PersistenceUnitInfo [
Jan 23 16:17:01 193.213.209.1 advisoradmin-server: 	name: default
Jan 23 16:17:01 193.213.209.1 advisoradmin-server: 	...]

The downside, obviously, is more traffic when logging multi-line log lines.

…eive them as one line with correct source and application, and the following lines without correct hostname.

This results in output looking like this:

Jan 23 16:04:56 193.213.209.1 advisoradmin-server: INFO o.h.jpa.internal.util.LogHelper:	HHH000204: Processing PersistenceUnitInfo [
Jan 23 16:04:56 193.213.209.1 logger: 	name: default
Jan 23 16:04:56 193.213.209.1 logger: 	...]

This occurs due to papertrails not handling the newlines as part of the same message. In practice this means that filtering on hostname filters out the corresponding lines from the log(!)

If, instead, we send the lines separately when logging on different lines, the lines will all contain the hostname.
With this patch, the resulting output looks like this:

Jan 23 16:17:01 193.213.209.1 advisoradmin-server: INFO  o.h.jpa.internal.util.LogHelper: HHH000204: Processing PersistenceUnitInfo [
Jan 23 16:17:01 193.213.209.1 advisoradmin-server: 	name: default
Jan 23 16:17:01 193.213.209.1 advisoradmin-server: 	...]

The downside, obviously, is more traffic when logging multi-line log lines.
@welcor welcor changed the title Multi-line logs Multi-line logs - stacktraces and others Jan 23, 2017
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

Successfully merging this pull request may close these issues.

None yet

1 participant