You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Shesha Nanda <sh...@gmail.com> on 2019/05/22 07:27:31 UTC

Ignite Audit logs into a separate file

Hi,

I am trying to store Ignite Audit logs into a separate file.
I have followed below steps.

I have created a log4j2.xml with console and file

<Configuration monitorInterval="60">
       <Appenders>
            <Console name="CONSOLE" target="SYSTEM_OUT">
               <PatternLayout
pattern="[%d{ISO8601}][%-5p][%t][%c{1}]%notEmpty{[%markerSimpleName]}
%m%n"/>
               <!-- <ThresholdFilter level="ERROR" onMatch="DENY"
onMismatch="ACCEPT"/>-->
            </Console>


            <RollingFile name="Audit-logs"
fileName="/opt/ignite/apache-ignite-2.7.0-bin/work/log/ignite-audit.log"

 filePattern="/opt/ignite/apache-ignite-2.7.0-bin/work/log/ignite-audit-%d{yyyy-MM-dd}.log.gz">
                     <PatternLayout
pattern="[%d{ISO8601}][%-5p][%t][%c{1}]%notEmpty{[%markerSimpleName]}
%m%n"/>
                  <!--  <PatternLayout>
                        <pattern>
                            {{ template "ignite-clog-pattern" . }}
                        </pattern>
                     </PatternLayout> -->
                      <Policies>
                          <TimeBasedTriggeringPolicy interval="6"
modulate="true" />
                          <SizeBasedTriggeringPolicy size="10 MB" />
                      </Policies>
            </RollingFile>
  </Appenders>

        <Loggers>
            <Logger name="org.apache.ignite" level="DEBUG"/.

            <Logger name="Audit-logs" level="debug" >
                 <appender-ref ref="Audit-logs" level="debug"/>
            </Logger>
<Root level="INFO">
                <AppenderRef ref="CONSOLE" level="DEBUG"/>
            </Root>
        </Loggers>
    </Configuration>


*In ignite created Audit-logs log object*

import java.util.logging.Logger;
Logger log1 = Logger.getLogger("Audit-logs");
log1.info("Hi Hello ...........................");

But logs are not coming into the file
"/opt/ignite/apache-ignite-2.7.0-bin/work/log/ignite-audit.log".

How configure new logger with separate file in Ignite code ?
Please let me know the  steps to send logs into separate file.




*Regards*
*Sheshananda*

Re: Ignite Audit logs into a separate file

Posted by sheshananda <sh...@gmail.com>.
Hi Igor ,

I am using log4j2 for the logs and I have done configuration mentioned in
the below link
https://apacheignite.readme.io/docs/logging#section-log4j2 

Now am trying to use gridLogger in my code.

How to use gridLogger  to create log object in my code with separate log
file.

Trying to pick "Audit-logs" configs from log4j2.xml


Thanks and regards
Sheshananda



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Ignite Audit logs into a separate file

Posted by ibelyakov <ig...@gmail.com>.
Hi,

In case you're going to use log4j2 as gridLogger for Ignite you should add
"ignite-log4j2" dependency and set up Log4J2Logger as described here:
https://apacheignite.readme.io/docs/logging#section-log4j2

Or in case you just want to use "Audit-logs" logger independently, you
should create logger in this way:

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

private static final Logger logger = LogManager.getLogger("HelloWorld");

logger.info("Hi Hello ...........................");

More information regarding log4j2 can be found here:
https://logging.apache.org/log4j/2.x/manual/api.html

Regards,
Igor



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/