Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with logs being stopped getting generated at midnight while using date based rollover strategy in log4j2 #2010

Closed
snaralasetty opened this issue Nov 27, 2023 · 14 comments
Labels

Comments

@snaralasetty
Copy link

Description

We are using log4j2 for logging in Sterling OMS product and observe that for 2 app servers, sometimes logging stops getting generated at midnight . Date based rollover strategy is implemented

Configuration

<RollingFile name="LULU_LOG_APPENDER" fileName="/opt/ssfs/runtime/logs/${sys:server_name:-}.log" filePattern="/opt/ssfs/runtime/logs/${sys:server_name:-}.log.%d{yyyy-MM-dd}">
        <PatternLayout pattern="%d:%-7p:%t: %-60m [%X{AppUserId}]: [%X{TenantId}]: %-25c{1}%n" />
	<Filters>
                    <SCILog4j2PatternFilter/>
            </Filters>
	<Policies>
		<TimeBasedTriggeringPolicy interval="1"/>
	</Policies> 
     </RollingFile>
	
     <RollingFile name="ALL" fileName="/opt/ssfs/runtime/logs/${sys:server_name:-}.log" filePattern="/opt/ssfs/runtime/logs/${sys:server_name:-}.log.%d{yyyy-MM-dd}">
        <PatternLayout pattern="%d:%-7p:%t: %-60m [%X{AppUserId}]: [%X{TenantId}]: %-25c{1}%n" />
	<Filters>
                    <SCILog4j2PatternFilter/>
            </Filters>
	<Policies>
		<TimeBasedTriggeringPolicy interval="1"/>
	</Policies> 
     </RollingFile>

Version: Log4J2

**Operating system: Unix (Sterling OMS v 10)

@snaralasetty
Copy link
Author

Anyone who can help on this?

@vy
Copy link
Member

vy commented Jan 17, 2024

Do you still observe this issue with the most recent Log4j version, that is, 2.22.1?

sometimes logging stops getting generated at midnight

  • Mind elaborating on this please?
  • Do you see any Log4j-generated logs on the issue? (They might be dumped to the console.)
  • Does /opt/ssfs/runtime/logs/${sys:server_name:-}.log continue getting populated by logs after midnight?

@snaralasetty
Copy link
Author

Hi vy,

  1. Yes, it is using 2.22.1 log4j version

The issue is that we sometimes see that at log rollover (every day at 00:00 logs get rolled over to new file), logs don't get written to the new file
2) If you mean application logs, we don't see any log4h generated logs
3) Yes, we still see /opt/ssfs/runtime/logs/${sys:server_name:-}.log getting populated but our info level logs don't get written anymore to the log file post midnight

Note: This happens some days and doesn't happen on other days

@ppkarwasz
Copy link
Contributor

What do the /opt/ssfs/runtime/logs/${sys:server_name:-}.log files contain? The TimeBasedTriggeringPolicy only triggers a rollover as a response to a log event, so they should not be empty.

Do you have enough free space on your filesystem?

@snaralasetty
Copy link
Author

Yes, We don't see any issues with free space.

The logs during rollover on the day which it stopped generating are below (masked ipaddress)

####<Dec 12, 2023 11:59:58,875 PM PST> <oms_server18> <> <> <1479c544-6132-4300-a3fd-4284f7a22e0e-0000000c> <1702454398875> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <Self-tuning thread pool contains 0 running threads, 3 idle threads, and 14 standby threads>
####<Dec 13, 2023 12:00:48,561 AM PST> <oms_server18> <[ACTIVE] ExecuteThread: '10' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <1479c544-6132-4300-a3fd-4284f7a22e0e-000005c3> <1702454448561> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <Scheduled 1 data retirement tasks as per configuration.>
####<Dec 13, 2023 12:00:48,561 AM PST> <oms_server18> <[ACTIVE] ExecuteThread: '16' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <1479c544-6132-4300-a3fd-4284f7a22e0e-000005c4> <1702454448561> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] >
####<Dec 13, 2023 12:00:50,307 AM PST> <oms_server18> <[ACTIVE] ExecuteThread: '16' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <1479c544-6132-4300-a3fd-4284f7a22e0e-000005c4> <1702454450307> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <Size based data retirement operation completed on archive HarvestedDataArchive. Retired 1,980 records in 1,746 ms.>
####<Dec 13, 2023 12:00:50,309 AM PST> <oms_server18> <[ACTIVE] ExecuteThread: '16' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <1479c544-6132-4300-a3fd-4284f7a22e0e-000005c4> <1702454450309> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] >
####<Dec 13, 2023 12:00:50,310 AM PST> <oms_server18> <[ACTIVE] ExecuteThread: '16' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <1479c544-6132-4300-a3fd-4284f7a22e0e-000005c4> <1702454450310> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <Size based data retirement operation completed on archive EventsDataArchive. Retired 0 records in 1 ms.>
####<Dec 13, 2023 12:00:58,830 AM PST> <oms_server18> <weblogic.GCMonitor> <> <> <1479c544-6132-4300-a3fd-4284f7a22e0e-00000008> <1702454458830> <[severity-value: 64] [rid: 0:1] [partition-id: 0] [partition-name: DOMAIN] > <52% of the total memory in the server is free.>

@snaralasetty
Copy link
Author

Any further update on this
Piotr P. Karwasz?

@ppkarwasz
Copy link
Contributor

@snaralasetty,

In the sample of your logs I can not find any message that matches the %d:%-7p:%t: %-60m [%X{AppUserId}]: [%X{TenantId}]: %-25c{1}%n pattern configured. Are you sure these are generated by Log4j Core?

If multiple logging backends are rotating the same files the results are unpredictable.

@snaralasetty
Copy link
Author

On this question, we have two appenders configured to write in log files. LULU_LOG_APPENDER and ALL. Would this be the reason for this behavior?

@ppkarwasz
Copy link
Contributor

Having two appenders logging to the same file is highly discouraged, but it could work (there should be a single RollingFileManager and one of the configurations will simply be ignored).

However if you have the same config on multiple web applications, it will fail and the logs of all but one application will be lost.

@ppkarwasz ppkarwasz added the waiting-for-user More information is needed from the user label Apr 23, 2024
Copy link

github-actions bot commented May 1, 2024

This issue is stale because it has been waiting for your feedback for more than 60 days. The Apache Logging Services community values every submitted issue, but without additional information from you, we are unable to provide a solution to your problem.
Please comment on this issue or it will be closed in 7 days.

@github-actions github-actions bot added the Stale label May 1, 2024
@rgoers
Copy link
Member

rgoers commented May 1, 2024

I would love to see what shows up with log4j2.debug=true set for the application during rollover. I don't think we actually have any tests for a configuration where two appenders will use the same rolling file manager. To be honest, since these are configured exactly the same I have no idea what the point of having two appenders is.

@github-actions github-actions bot removed the Stale label May 2, 2024
Copy link

github-actions bot commented May 9, 2024

This issue is stale because it has been waiting for your feedback for more than 60 days. The Apache Logging Services community values every submitted issue, but without additional information from you, we are unable to provide a solution to your problem.
Please comment on this issue or it will be closed in 7 days.

@github-actions github-actions bot added the Stale label May 9, 2024
@ppkarwasz
Copy link
Contributor

There must be a bug in the Github Stale action. I'll check it out.

@github-actions github-actions bot removed the Stale label May 10, 2024
Copy link

github-actions bot commented Jul 9, 2024

This issue is stale because it has been waiting for your feedback for more than 60 days. The Apache Logging Services community values every submitted issue, but without additional information from you, we are unable to provide a solution to your problem.
Please comment on this issue or it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jul 9, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 16, 2024
@ppkarwasz ppkarwasz removed the waiting-for-user More information is needed from the user label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants