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

added StandardErrorCallback class plus errorCallback field for config #215

Merged

Conversation

stokpop
Copy link
Contributor

@stokpop stokpop commented Nov 16, 2021

The StandardErrorCallback class can be registered via the errorCallback field in log4j/logback/java-logging config.
It logs to std err.

This is for issue 214.

Or custom errorCallbacks can be registered.

When using the StandardErrorCallback the following property can be used to also log stack traces:

-Dcom.splunk.logging.util.StandardErrorCallback.enablePrintStackTrace=true

Note this PR also includes a little change working with com.splunk.logging.HttpEventCollectorErrorHandler.ServerErrorException: it seemed not to make sense to wrap regular exceptions (e.g. non-Splunk errors that have json message with error code) inside a ServerErrorException.

@vmalaviya-splunk
Copy link
Contributor

@stokpop PR looks good.
One minor change, could you please remove the version change info from the README and CHANGELOG?

Could you also elaborate on why the custom-exception (HttpEventCollectorErrorHandler.ServerErrorException) has been removed and instead general-exception (Exception) is used?

@stokpop
Copy link
Contributor Author

stokpop commented Mar 10, 2022

@vmalaviya-splunk thanks for reviewing the PR, I have reverted the changes in README and CHANGELOG.

The (HttpEventCollectorErrorHandler.ServerErrorException) is still there and used where appropriate: for Splunk server errors, where a json error message is returned and used as input to the ServerErrorException. When errors occur like TimeoutOutExceptions, that are not errors returned from the Splunk server, it does not make sense to use the ServerErrorException, imho. See for instance the code in: com.splunk.logging.HttpEventCollectorSender#postEventsAsync, the completed() method deals with server errors with json message, but the failed() method has only Exception and no json to use.

@bparmar-splunk bparmar-splunk merged commit eaabf14 into splunk:main Mar 28, 2022
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

3 participants