1

Hello is there a way to create log file in network path such as in LAN folder, but by folder that have date pattern like this:

\\10.0.0.1\logs\2014\NOVEMBER\logs.log ?

I already have log file XML based, using java util logging, but it has problem while log viewer parse the log file.

thanks for your response.

OO7
  • 2,785
  • 1
  • 21
  • 33

1 Answers1

0

You can use SocketAppender. It allows to write log on remote host. Log4j2 - SocketAppender.

Sample Log4j Configuration :

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" name="MyApp" packages="">
    <Appenders>
        <Socket name="socket" host="localhost" port="9500">
            <SerializedLayout />
        </Socket>
    </Appenders>
    <Loggers>
    <Root level="error">
        <AppenderRef ref="socket"/>
    </Root>
    </Loggers>
</Configuration>

Also have a look at below posts :

  1. How to use SocketAppender ?
  2. Log4j SocketAppender and socket server example
Community
  • 1
  • 1
OO7
  • 2,785
  • 1
  • 21
  • 33