dosubot[bot] commented on issue #2581:
URL:
https://github.com/apache/incubator-hugegraph/issues/2581#issuecomment-2225129792
<!-- Answer -->
The log file defined by the `OUTPUT` variable in the `start-hugegraph-pd.sh`
script does not scroll according to the rules defined by `log4j2.xml` because
the `OUTPUT` variable is not referenced or used within the `log4j2.xml`
configuration file. The log4j2 configuration specifies log file paths using the
`${LOG_PATH}` and `${FILE_NAME}` properties, but there is no mention of an
`OUTPUT` variable.
To ensure the log file scrolls according to the rules defined in
`log4j2.xml`, you need to make sure that the `OUTPUT` variable in your script
matches the log file paths specified in the `log4j2.xml` configuration.
For example, if `OUTPUT` is intended to be the main log file, it should
match `${LOG_PATH}/${FILE_NAME}.log`:
```sh
OUTPUT="logs/hugegraph-pd.log"
```
Ensure that the script and the log4j2 configuration are aligned in terms of
log file paths. The `log4j2.xml` configuration uses the following properties
for log file paths:
```xml
<properties>
<property name="LOG_PATH">logs</property>
<property name="FILE_NAME">hugegraph-pd</property>
</properties>
```
The main log file is defined as:
```xml
<RollingRandomAccessFile name="file" fileName="${LOG_PATH}/${FILE_NAME}.log"
filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log"
bufferedIO="true" bufferSize="524288"
immediateFlush="false">
<ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} -
%m%n" />
<Policies>
<SizeBasedTriggeringPolicy size="128MB" />
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<DefaultRolloverStrategy max="16">
<Delete basePath="${LOG_PATH}" maxDepth="2">
<IfFileName glob="*/*.log" />
<IfAny>
<IfAccumulatedFileSize exceeds="2GB" />
<IfAccumulatedFileCount exceeds="100" />
</IfAny>
</Delete>
</DefaultRolloverStrategy>
</RollingRandomAccessFile>
```
Make sure the `OUTPUT` variable in your script is set to
`logs/hugegraph-pd.log` to match the log file path defined in `log4j2.xml`
<sup>[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-pd/hg-pd-service/src/test/resources/log4j2.xml)</sup><sup>[[2]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-pd/hg-pd-service/src/main/resources/log4j2.xml)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]