Skip to content

Commit

Permalink
Add fully qualified class name and line number for logging. (#164)
Browse files Browse the repository at this point in the history
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
Updated logback settings to include fully qualified class name and line
number to log statements (https://logback.qos.ch/manual/layouts.html)
<!--- Describe your changes in detail -->

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context
Improve usability of log files
<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?
Locally integration tests
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Defect fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have added any new packages to the sonar-scanner.properties file
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the **CONTRIBUTING** document.
[CARMA Contributing Guide](Contributing.md) 
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
  • Loading branch information
kjrush authored Oct 25, 2023
2 parents 92fc8fe + 5c930be commit eb85c4a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions co-simulation/bundle/src/assembly/resources/etc/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<property name="logDirectory" value="${logDirectory}"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="STDOUT-Progress" class="ch.qos.logback.core.ConsoleAppender">
Expand All @@ -26,7 +26,7 @@
<charset>UTF-8</charset>
<file>${logDirectory}/MOSAIC.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>

Expand All @@ -35,15 +35,15 @@
<charset>UTF-8</charset>
<file>${logDirectory}/Mapping.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>

<appender name="ApplicationLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/Application.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="ApplicationLogDelegation" class="ch.qos.logback.classic.sift.SiftingAppender">
Expand All @@ -67,71 +67,71 @@
<immediateFlush>true</immediateFlush>
<file>${logDirectory}/Navigation.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="TrafficLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/Traffic.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="CarlaLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/Carla.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="CarmaLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/Carma.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="InfrastructureLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/Infrastructure.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="EnvironmentLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/Environment.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="CommunicationLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/Communication.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="CommunicationDetailsLog" class="ch.qos.logback.core.FileAppender">
<file>${logDirectory}/CommunicationDetails.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
<append>false</append>
</appender>
<appender name="CellLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/Cell.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>

<appender name="ActivityLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/RuntimeEvents.csv</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %logger{0} [%thread] - %msg%n</pattern>
<pattern>%date %-5level %C{0}:%line [%thread] - %msg%n</pattern>
</encoder>
</appender>

Expand Down

0 comments on commit eb85c4a

Please sign in to comment.