daffodil icon indicating copy to clipboard operation
daffodil copied to clipboard

Daffodil 2643 tdml logs

Open alexanderrevello opened this issue 2 years ago • 4 comments

TDML unit tests can now capture and look for logs Like they do for warnings and errors, logs completed through log4j are captured and can be required in the tdml test cases. The root logger level is by default warning and when a tdml test is run, that level is changed to info in order to capture logs. Tests were added to demonstrate the feature as well as how it works in conjunction with warnings and errors. Library dependencies were updated to give tdml-lib access to log4jcore libraries needed to make an abstractappender

DAFFODIL-2643

alexanderrevello avatar Mar 31 '22 04:03 alexanderrevello

After your next commit, wait for the CI tests to finish so we can check whether the single windows error was a fluke or not:

[error] Test org.apache.daffodil.tdml.TestTDMLRunnerLogs.test_unparserLogWhenExpectingError failed: org.apache.daffodil.tdml.TDMLExceptionImpl: (Implementation: daffodil) "Diagnostic message(s) were expected but not found."
[error] Expected: dfdlx:trace
[error]  No diagnostic messages were issued., took 0.65 sec

It will be good to run the CI tests two more times (after your next commit, and then again after your squashed commit).

tuxji avatar Mar 31 '22 16:03 tuxji

The TDML runner needs log4j core, so the CLI will because it can run TDML tests. But Daffodil proper, used via API as it would be when embedded into a system, should not need this logger specified. That tradeoff feels ok to me.

mbeckerle avatar Apr 01 '22 19:04 mbeckerle

The TDML runner needs log4j core, so the CLI will because it can run TDML tests. But Daffodil proper, used via API as it would be when embedded into a system, should not need this logger specified. That tradeoff feels ok to me.

Good point. So it seems in that case the new log4j-core API should not be part of the core dependencies, but instead should be added only to the tdmlLib project, similar to how we add it to the CLI? So something like:

Dependencies.scala

class Dependencies {
  ....

  lazy val tdml = Seq(
    "org.apache.logging.log4j" % "log4j-core" % "2.17.2"
  )
}

build.sbt

lazy val tdmlLib = Project(...)
                   ...
                   .settings(libraryDependencies ++= Dependencies.tdml)

stevedlawrence avatar Apr 01 '22 19:04 stevedlawrence

Please resolve everyone's comments, then we can merge your pull request.

tuxji avatar May 13 '22 18:05 tuxji

Closed as inactive. A link is in the DAFFODIL-2643 issue back to this PR.

mbeckerle avatar Feb 06 '24 19:02 mbeckerle