You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "veenaBOL (via GitHub)" <gi...@apache.org> on 2026/03/31 09:37:24 UTC
[I] Log messages appear to be trimmed when using PatternLayout %m%n [logging-log4j2]
veenaBOL opened a new issue, #4088:
URL: https://github.com/apache/logging-log4j2/issues/4088
## Description
We are observing that log messages are getting truncated when logged using Log4j, particularly when using the following configuration:
<PatternLayout pattern='%m%n'/>
This impacts critical logs such as log.fatal(message, throwable) where the complete message or stack trace is not fully printed. This is particularly noticeable for fatal and error logs where the message size is significantly large.
## Configuration
**Version:** 2.25.3
**Operating system:** macOS 15.6
**JDK:** OpenJDK 17.0.12
## Reproduction
1. Configure Log4j with:
<PatternLayout pattern='%m%n'/>
2. Log a message with a large string or exception:
3. log.fatal("Large message...", throwable);
Check the output logs.
--
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: notifications-unsubscribe@logging.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Log messages appear to be trimmed when using PatternLayout %m%n [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #4088:
URL: https://github.com/apache/logging-log4j2/issues/4088#issuecomment-4231087112
@veenaBOL, would you mind providing a minimal reproducer (composed of a `pom.xml` and a `src/main/java/Repro.java`), please?
If you're using `log4j-to-slf4j`, you might be bitten by #4068. If so, would you mind verifying if #4089 fixes your problem, please?
--
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: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Log messages appear to be trimmed when using PatternLayout %m%n [logging-log4j2]
Posted by "veenaBOL (via GitHub)" <gi...@apache.org>.
veenaBOL commented on issue #4088:
URL: https://github.com/apache/logging-log4j2/issues/4088#issuecomment-4437737372
Hi @vy ,
Apologies for the delay in getting back on this. I’ve investigated the logging setup further.
We are using: log4j-slf4j2-impl:2.20.0
So the previously mentioned issue (log4j-to-slf4j #4068 / #4089) is not applicable in our case, since we are not using the log4j-to-slf4j bridge.
I also noticed a version mismatch in our logging stack:
log4j-core: 2.25.3
log4j-api: 2.25.3
log4j-slf4j2-impl: 2.20.0
Could you please confirm whether such a version mismatch between log4j-core and log4j-slf4j2-impl could potentially lead to issues like; incomplete / truncated log output , missing stack traces .
Please find the minimal reproducer to isolate the issue. It includes:
- Log4j configuration (AsyncLogger + JSONLayout + Sentry appender)
- A simple Java main class logging a large message + throwable
- Maven pom.xml with required logging dependencies
[untitled folder.zip](https://github.com/user-attachments/files/27693209/untitled.folder.zip)
--
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: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Log messages appear to be trimmed when using PatternLayout %m%n [logging-log4j2]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #4088:
URL: https://github.com/apache/logging-log4j2/issues/4088#issuecomment-4953831814
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.
--
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: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Log messages appear to be trimmed when using PatternLayout %m%n [logging-log4j2]
Posted by "ramanathan1504 (via GitHub) via notifications" <no...@logging.apache.org>.
ramanathan1504 commented on issue #4088:
URL: https://github.com/apache/logging-log4j2/issues/4088#issuecomment-6703398034
Is this still a problem with the latest 2.x release? If we do not hear back in 14 days, we will close this issue.
--
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: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Log messages appear to be trimmed when using PatternLayout %m%n [logging-log4j2]
Posted by "ramanathan1504 (via GitHub)" <gi...@apache.org>.
ramanathan1504 commented on issue #4088:
URL: https://github.com/apache/logging-log4j2/issues/4088#issuecomment-4443130142
@veenaBOL
# Reproducer Run Report
Date: 2026-05-13
## Scope
This report was produced without modifying the original user files in the root folder:
- `pom.xml`
- `Repro.java`
- `log4j2.xml`
## Folder setup
Two separate folders were created from the same 3 user files:
1. `repro-original/` - direct copy, no dependency changes.
2. `repro-with-deps/` - same copy, then only `pom.xml` in this folder was updated.
## Change made only in `repro-with-deps/pom.xml`
Added missing runtime dependencies required by the existing config:
- `com.lmax:disruptor:3.4.4` (required by `AsyncLogger` / `AsyncRoot`)
- `com.fasterxml.jackson.core:jackson-databind:2.18.2` (required by `JSONLayout`)
Reference for async logging setup:
- https://logging.apache.org/log4j/2.x/manual/async.html
## Run results
| Check | `repro-original` | `repro-with-deps` |
|---------------------|-----------------:|------------------:|
| `stdout_lines` | 5 | 2 |
| `stderr_lines` | 149 | 0 |
| `has_json` | false | true |
| `message_len` | 0 | 200000 |
| `has_thrown` | false | true |
| `stack_frames` | 0 | 1 |
| `missing_jackson` | true | false |
| `missing_disruptor` | true | false |
## Observed issue in original copy
In `repro-original/`, Log4j configuration initialization reports missing classes for:
- Jackson Databind (`FilterProvider`)
- Disruptor (`com/lmax/disruptor/EventHandler`)
Because of that, the intended `AsyncLogger + JSONLayout` path is not active in the original copied setup.
## Conclusion
- The issue in the direct user-copy run is missing runtime dependencies for the configured logging pipeline.
- After adding those dependencies in the second folder, the same code logs a full JSON event with full 200k message and throwable stack trace.
--
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: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Log messages appear to be trimmed when using PatternLayout %m%n [logging-log4j2]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #4088:
URL: https://github.com/apache/logging-log4j2/issues/4088#issuecomment-5650023474
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.
--
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: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org