You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/01/28 02:33:56 UTC
[GitHub] ambition119 commented on a change in pull request #3434: [Issue
3390] UncaughtExceptionLogsNOTWork
ambition119 commented on a change in pull request #3434: [Issue 3390] UncaughtExceptionLogsNOTWork
URL: https://github.com/apache/pulsar/pull/3434#discussion_r251270165
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java
##########
@@ -273,8 +277,9 @@ public void shutdown() {
public static void main(String[] args) throws Exception {
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss,SSS");
Thread.setDefaultUncaughtExceptionHandler((thread, exception) -> {
- log.error("Uncaught exception in thread {}: {}", thread.getName(), exception.getMessage(), exception);
+ System.out.println(String.format("%s [%s] error Uncaught exception in thread %s: %s", dateFormat.format(new Date()), thread.getContextClassLoader(), thread.getName(), exception.getMessage()));
Review comment:
@merlimat @foreversunyao use log4j properties redirect to System.out would be better
like
```yaml
- name: log4j.appender.CONSOLE
default: org.apache.log4j.ConsoleAppender
- name: log4j.appender.CONSOLE.Threshold
default: ERROR
- name: log4j.appender.CONSOLE.Target
default: System.out
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services