Skip to content

Commit

Permalink
move appender setup to log4j config (#400)
Browse files Browse the repository at this point in the history
For more details see:

http://netflix.github.io/spectator/en/latest/ext/log4j2/

Which is a bit out of date, with the change below the
ordering issues are no longer a problem when using the
appender via the config:

Netflix/spectator@33825db#diff-9bc272482ec3aa21411ff595a1f4225f
  • Loading branch information
brharrington authored Jul 21, 2016
1 parent 4188e3b commit 4c360d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 2 additions & 0 deletions atlas-standalone/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
<Console name="STDERR" target="SYSTEM_ERR">
<PatternLayout pattern="${dfltPattern}"/>
</Console>
<Spectator name="SPECTATOR"/>
</Appenders>
<Loggers>
<Logger name="com.netflix.spectator" level="debug"/>
<Root level="info">
<AppenderRef ref="STDERR"/>
<AppenderRef ref="SPECTATOR"/>
</Root>
</Loggers>
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import com.netflix.iep.service.Service
import com.netflix.iep.service.ServiceManager
import com.netflix.spectator.api.Registry
import com.netflix.spectator.api.Spectator
import com.netflix.spectator.log4j.SpectatorAppender
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import com.typesafe.scalalogging.StrictLogging
Expand All @@ -59,8 +58,6 @@ object Main extends StrictLogging {

def main(args: Array[String]): Unit = {
try {
val registry = Spectator.globalRegistry()
SpectatorAppender.addToRootLogger(registry, "spectator", false)
loadAdditionalConfigFiles(args)
start()
guice.addShutdownHook()
Expand Down

0 comments on commit 4c360d3

Please sign in to comment.