Skip to content

Commit

Permalink
camel-jbang - Make camel log read spring boot logs
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Apr 29, 2024
1 parent 7c56387 commit 215397b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ private String alignTimestamp(String line) {
ts = ts.replace('T', ' ');
int dot = ts.indexOf('.');
if (dot != -1) {
ts = ts.substring(0, dot + 4);
int pos1 = dot + 3; // skip these 6 chars
int pos2 = dot + 9;
ts = ts.substring(0, pos1) + ts.substring(pos2);
}
String after = StringHelper.after(line, " ");
return ts + " " + after;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ appender.file.createOnDemand = true
appender.file.append = false
appender.file.layout.type = PatternLayout
# logging style that is similar to spring boot
appender.file.layout.pattern = %style{%d{yyyy-MM-dd HH:mm:ss.SSS}}{Dim} %highlight{%5p} %style{%pid}{Magenta} %style{---}{Dim} %style{[%15.15t]}{Dim} %style{%-35.35c}{Cyan} : %m%n
appender.file.layout.pattern = %style{%d{yyyy-MM-dd HH:mm:ss.SSS}}{Dim} %highlight{%5p} %style{%pid}{Magenta} %style{---}{Dim} %style{[%15.15t]}{Dim} %style{%-40.40c}{Cyan} %style{:}{Dim} %m%n

# log to file
rootLogger = INFO,file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ appender.stdout.type = Console
appender.stdout.name = out
appender.stdout.layout.type = PatternLayout
# logging style that is similar to spring boot
appender.stdout.layout.pattern = %style{%d{yyyy-MM-dd HH:mm:ss.SSS}}{Dim} %highlight{%5p} %style{%pid}{Magenta} %style{---}{Dim} %style{[%15.15t]}{Dim} %style{%-35.35c}{Cyan} : %m%n
appender.stdout.layout.pattern = %style{%d{yyyy-MM-dd HH:mm:ss.SSS}}{Dim} %highlight{%5p} %style{%pid}{Magenta} %style{---}{Dim} %style{[%15.15t]}{Dim} %style{%-40.40c}{Cyan} %style{:}{Dim} %m%n

# file logger
appender.file.type = File
Expand All @@ -30,7 +30,7 @@ appender.file.createOnDemand = true
appender.file.append = false
appender.file.layout.type = PatternLayout
# logging style that is similar to spring boot
appender.file.layout.pattern = %style{%d{yyyy-MM-dd HH:mm:ss.SSS}}{Dim} %highlight{%5p} %style{%pid}{Magenta} %style{---}{Dim} %style{[%15.15t]}{Dim} %style{%-35.35c}{Cyan} : %m%n
appender.file.layout.pattern = %style{%d{yyyy-MM-dd HH:mm:ss.SSS}}{Dim} %highlight{%5p} %style{%pid}{Magenta} %style{---}{Dim} %style{[%15.15t]}{Dim} %style{%-40.40c}{Cyan} %style{:}{Dim} %m%n

# log to console and file
rootLogger = INFO,out,file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
-->
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<include resource="org/springframework/boot/logging/logback/file-appender.xml"/>
<property name="LOG_FILE" value="${user.home}${file.separator}.camel${file.separator}${PID}.log"/>
<property name="FILE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN}"/> <!-- log in color to file -->
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</configuration>

0 comments on commit 215397b

Please sign in to comment.