Skip to content

Commit

Permalink
v1.4 - allow explicit level configuration using name prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
arkanovicz committed Sep 1, 2018
1 parent 47cf087 commit 6e5bda7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ under the License.
</parent>
<groupId>com.republicate</groupId>
<artifactId>webapp-slf4j-logger</artifactId>
<version>1.4-dev</version>
<version>1.4</version>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>SLF4J backend to log to a WebApp's ServletContext</description>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/republicate/slf4j/impl/ServletContextLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,16 @@ public static ServletContext getServletContext()
{
this.name = name;
Level level = explicitLevels.get(name);
while (level == null)
{
int dot = name.lastIndexOf('.');
if (dot == -1) break;
else
{
name = name.substring(0, dot);
level = explicitLevels.get(name);
}
}
if (level != null)
{
loggerLevel = level;
Expand Down

0 comments on commit 6e5bda7

Please sign in to comment.