# Log rotation settings for ZebraTester Processes

From 7.0-B version , ZT support multiple loggers and also support logs rotations

Below is an example that shows how you configure the log rotation in ZT for a Windows Execution Agent Process

After installing the latest version of ZebraTester 7.0B, follow the below steps:

1. Edit the file NSSM\_ExecAgentServiceWin64.bat and append the jars log4j-core-2.17.1.jar and log4j-api-2.17.1.jar to the classpath like below

```
"%INSTALL_DIR%\jre\bin\java.exe" -Xmx2048m -Dfile.encoding=UTF8 -classpath ".;%INSTALL_DIR%;%INSTALL_DIR%\prxsniff.jar;%INSTALL_DIR%\iaik_jce_full.jar;%INSTALL_DIR%\iaik_ssl.jar;%INSTALL_DIR%\iaik_eccelerate_ssl.jar;%INSTALL_DIR%\iaik_eccelerate.jar;%INSTALL_DIR%\iaikPkcs11Provider.jar;%INSTALL_DIR%\iaikPkcs11Wrapper.jar;%INSTALL_DIR%\log4j-core-2.17.1.jar;%INSTALL_DIR%\log4j-api-2.17.1.jar" ExecAgent -jobdir "%INSTALL_DIR%\ExecAgentJobs" -tz %TIME_ZONE% -dgs %NUMBER_FORMAT% -enableJobOverrideJavaMemory -log4j
```

2\. As you can see in the above start command also add the -log4j parameter to the ExecAgent java process.

3\. Edit the log4j2.xml and configure the log rotation based on your need ; here I am configuring based on size, also you can see the below configuration supports 2 loggers one for ZT controller and other for Agent.

```
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" monitorInterval="30">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{dd MMM yyyy HH:mm:ss} %logger{36} [%t] %-5level %msg%n"/>
</Console>
<RollingFile name="ztservLog" filename="ZebraTesterService.log" filePattern="ZebraTesterService-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="%d{dd MMM yyyy HH:mm:ss} %logger{36} [%t] %-5level %msg%n"/>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB" />
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingFile>
<RollingFile name="ztexecagentLog" filename="ZebraTesterExecAgent.log" filePattern="ZebraTesterExecAgent-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="%d{dd MMM yyyy HH:mm:ss} %logger{36} [%t] %-5level %msg%n"/>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB" />
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="ZBA" level="info" additivity="false">
<AppenderRef ref="ztservLog"/>
<AppenderRef ref="Console"/>
</Logger>
<Logger name="ExecAgent" level="info" additivity="false">
<AppenderRef ref="ztexecagentLog"/>
<AppenderRef ref="Console"/>
</Logger>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
```

4\. Now Install ZT Execution Agent Process as as Service (using InstallExecAgentServiceWin64.bat) or Restart the already installed service


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apica.io/platform-docs/zebratester-scripting/zebratester-user-guide/advanced-topics/log-rotation-settings-for-zebratester-processes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
