Re: [D] Exception causes are truncated while logging exceptions with line number limit [logging-log4j2]

2025-07-07 Thread via GitHub


GitHub user vy added a comment to the discussion: Exception causes are 
truncated while logging exceptions with line number limit

@ZOUG, a `Throwable` is essentially composed of 3 parts:

1. The stack trace (i.e., `StackTraceElement[]`)
2. A cause (of type `Throwable`)
3. The suppressed exceptions (of type `Throwable[]`)

`Throwable::printStackTrace` renders _all these_ and this is what `%ex` 
operates on. That is, given `%ex{N}`, Log4j Core retains the first `N` lines of 
the rendered stack trace.

AFAICT, `%ex{N}` was introduced to avoid excessive stack traces, not to trim 
redundant information. For your case, I can suggest following options:

1. Combine `%ex` with `%rEx`
2. Experiment with discarding certain packages using 
`filters(package,package,...)`
3. [Implement a custom exception 
converter](https://logging.apache.org/log4j/2.x/manual/pattern-layout.html#extending)
 matching the behavior of `%ex` in Logback
4. Submit a feature request

Would you mind sharing a little bit more detail about your deployment setup, 
please? You write these logs to a... file? If so, then what happens next? Do 
you feed them to ELK? Can you use [JSON Template 
Layout](https://logging.apache.org/log4j/2.x/manual/json-template-layout.html) 
instead, since it provides an [`exceptionRootCause` 
resolver](https://logging.apache.org/log4j/2.x/manual/json-template-layout.html#event-template-resolver-exceptionRootCause)?

GitHub link: 
https://github.com/apache/logging-log4j2/discussions/3803#discussioncomment-13681035


This is an automatically sent email for dev@logging.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@logging.apache.org



Re: [VOTE] Release Apache Log4j `2.25.1` (RC1)

2025-07-07 Thread Matt Sicker
Something is buggy for me in the Maven wrapper script which causes this error 
to print out:

mvnw: line 114: mvnw/.mvn/wrapper/maven-wrapper.properties: Not a directory
cannot read distributionUrl property in 
mvnw/.mvn/wrapper/maven-wrapper.properties

When I tried running the build with a local copy of Maven, I get a different 
error:

[ERROR] size mismatch log4j-api-2.25.1-sources.jar: investigate with diffoscope 
log4j-api/target/reference/org.apache.logging.log4j/log4j-api-2.25.1-sources.jar
 log4j-api/target/log4j-api-2.25.1-sources.jar
[ERROR] size mismatch log4j-api-2.25.1.module: investigate with diffoscope 
log4j-api/target/reference/org.apache.logging.log4j/log4j-api-2.25.1.module 
log4j-api/target/publications/maven/module.json
[ERROR] Reproducible Build output summary: 3 files ok, 2 different
[ERROR] see diff log4j-api/target/reference/log4j-api-2.25.1.buildinfo 
log4j-api/target/log4j-api-2.25.1.buildinfo

The diff:

0a1,15
> # https://reproducible-builds.org/docs/jvm/
> buildinfo.version=1.0-SNAPSHOT
> 
> name=Apache Log4j API
> group-id=org.apache.logging.log4j
> artifact-id=log4j-api
> version=2.25.1
> 
> # source information
> source.scm.uri=scm:git:https://github.com/apache/logging-log4j2.git
> source.scm.tag=rel/2.25.1
> 
> # build instructions
> build-tool=mvn
> 
2,3c17,19
< java.version=17 (from MANIFEST.MF Build-Jdk-Spec)
< os.name=Unix (from pom.properties newline)
---
> java.version=17.0.15
> java.vendor=Apple Inc.
> os.name=Mac OS X
4a21,25
> # Maven rebuild instructions and effective environment
> mvn.version=3.9.10
> 
> # output
> 
22,23c43,44
< outputs.3.length=293959
< 
outputs.3.checksums.sha512=a85f1d8b55567e579d23a5c73f3d7345dce5b835cb792f542f64d28250d307531f0e91817e61bd9ca6a2069d6992641e65ed4c3a3b8d699b52ebd6bf4c08e18c
---
> outputs.3.length=293922
> outputs.3.checksums.sha512=104f3d1d5c4ba247b919f622653eb9f8f44d3780b742104d4b68cc09af5b30655e202480f5a0a957efeb85260e10b440c56c2fac8c114927bbb194df135c9c24
27,28c48,49
< outputs.4.length=2906
< 
outputs.4.checksums.sha512=6811bd5c5b51012c2734331338089aade55708afa619761cbe129a1fc68d6e1be3c8f32d601689d0811784496ad2523979106f92560086b0f107dbb691e87511
---
> outputs.4.length=2907
> outputs.4.checksums.sha512=bdfb25da0e910bd45e1f30007e9ab19aa3a802e5471d6266599f2b231f8a8a39e0f3790e212b4dac5c96e3642ae04b962a414c95fb6f7f760807358973ba9a43


> On Jul 5, 2025, at 16:08, Piotr P. Karwasz  wrote:
> 
> te