log4j2-extended-jsonlayout-spring-auth

Extended JSONLayout for Log4j2 that includes Spring Authentication details

License

License

Categories

Categories

Ant Build Tools Net JSON Data
GroupId

GroupId

net.savantly.log4j2
ArtifactId

ArtifactId

extended-jsonlayout-spring-auth
Last Version

Last Version

1.0.0-RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

log4j2-extended-jsonlayout-spring-auth
Extended JSONLayout for Log4j2 that includes Spring Authentication details
Project Organization

Project Organization

savantly.net
Source Code Management

Source Code Management

https://github.com/savantly-net/log4j2-extended-jsonlayout-spring-auth

Download extended-jsonlayout-spring-auth

How to add to project

<!-- https://jarcasting.com/artifacts/net.savantly.log4j2/extended-jsonlayout-spring-auth/ -->
<dependency>
    <groupId>net.savantly.log4j2</groupId>
    <artifactId>extended-jsonlayout-spring-auth</artifactId>
    <version>1.0.0-RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/net.savantly.log4j2/extended-jsonlayout-spring-auth/
implementation 'net.savantly.log4j2:extended-jsonlayout-spring-auth:1.0.0-RELEASE'
// https://jarcasting.com/artifacts/net.savantly.log4j2/extended-jsonlayout-spring-auth/
implementation ("net.savantly.log4j2:extended-jsonlayout-spring-auth:1.0.0-RELEASE")
'net.savantly.log4j2:extended-jsonlayout-spring-auth:jar:1.0.0-RELEASE'
<dependency org="net.savantly.log4j2" name="extended-jsonlayout-spring-auth" rev="1.0.0-RELEASE">
  <artifact name="extended-jsonlayout-spring-auth" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.savantly.log4j2', module='extended-jsonlayout-spring-auth', version='1.0.0-RELEASE')
)
libraryDependencies += "net.savantly.log4j2" % "extended-jsonlayout-spring-auth" % "1.0.0-RELEASE"
[net.savantly.log4j2/extended-jsonlayout-spring-auth "1.0.0-RELEASE"]

Dependencies

compile (2)

Group / Artifact Type Version
net.savantly.log4j2 : extended-jsonlayout jar 1.0.0
org.springframework.security : spring-security-core jar 4.2.3.RELEASE

test (5)

Group / Artifact Type Version
junit : junit jar 4.12
org.springframework : spring-context jar 4.2.3.RELEASE
org.springframework.security : spring-security-test jar 4.2.3.RELEASE
org.springframework.security : spring-security-config jar 4.2.3.RELEASE
org.apache.logging.log4j : log4j-jcl jar 2.8.2

Project Modules

There are no modules declared in this project.

log4j2-extended-jsonlayout-spring-auth

Extended JSONLayout for Log4j2 that includes Spring Authentication details

Build Status

Include the artifact

	<dependency>
		<groupId>net.savantly.log4j2</groupId>
		<artifactId>extended-jsonlayout-spring-auth</artifactId>
		<version>1.0.0-RELEASE</version>
	</dependency>

Example Usage

Inside your log4j2 configuration, you can configure the new pattern "ExtendedJsonLayout"

	<Appenders>
		<Console name="STDOUT" target="SYSTEM_OUT">
			<ExtendedJsonLayout complete="false" properties="true"
				 jsonAdapterClassName="net.savantly.log4j.layout.SpringAuthExtender"/>
		</Console>
	</Appenders>
	

Example output

{
  "timeMillis" : 1503390773796,
  "thread" : "main",
  "level" : "INFO",
  "loggerName" : "org.springframework.data.repository.config.RepositoryConfigurationDelegate",
  "message" : "Multiple Spring Data modules found, entering strict repository configuration mode!",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.slf4j.Log4jLogger",
  "contextMap" : { },
  "threadId" : 1,
  "threadPriority" : 5,
  "authentication" : {username: "testUser"}
}

*Note - You can subclass the SpringAuthExtender to add your own "authentication" objects to the log message.

net.savantly.log4j2

Savantly

Savantly custom software solutions for your business

Versions

Version
1.0.0-RELEASE