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

Update log configurations [ECR-3139] #854

Merged
merged 16 commits into from
Apr 25, 2019

Conversation

dmitry-timofeev
Copy link
Contributor

@dmitry-timofeev dmitry-timofeev commented Apr 22, 2019

Overview

Update log configurations:

  1. Configure SLF4J->Log4j binding
  2. Update log configurations:
    • For Java tests — to print to stdout our debug messages and warnings from 3rd-party libraries;
    • For native tests — to print only fatal errors. That reduces the number of log messages in build output.
  3. Redirect any output of unit and integration Java tests to files.
  4. Move the log4j configuration for native ITs to native ITs
    so that it is (a) easily discoverable; (b) can be changed with no
    recompilation of Java fakes module.
  5. Also, pass the path to the Log4j configuration file to the
    service runtime bootstrap test to remove the error message from logs.

See: https://jira.bf.local/browse/ECR-3139?focusedCommentId=43246&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-43246

Definition of Done

  • There are no TODOs left in the code
  • Change is covered by automated tests
  • The coding guidelines are followed
  • Public API has Javadoc
  • Method preconditions are checked and documented in the Javadoc of the method
  • Changelog is updated if needed (in case of notable or breaking changes)
  • The continuous integration build passes

@dmitry-timofeev dmitry-timofeev added the work-in-progress 👷‍♂️ Do not expect reviewers to provide any feedback on WIP PRs — please ask for it explicitly! label Apr 22, 2019
@coveralls
Copy link

coveralls commented Apr 22, 2019

Coverage Status

Coverage remained the same at 85.388% when pulling d05e1c5 on dmitry-timofeev:tap-slf4j-logs-ECR-3139 into aeba822 on exonum:master.

dmitry-timofeev and others added 8 commits April 23, 2019 15:46
Use 'debug' for our code only; 'warn' — for anything else.
Send any warnings to stdout; our debug entries — to stdout and
the list appender.
That reduces the number of log messages in build output.
Move the log4j configuration for native ITs to native ITs
so that it is (a) easily discoverable; (b) can be changed with no
recompilation of Java `fakes` module.

Also, pass the path to the Log4j configuration file to the
service runtime bootstrap test to remove the error message from logs.
@dmitry-timofeev dmitry-timofeev force-pushed the tap-slf4j-logs-ECR-3139 branch from 6a51a75 to c670c73 Compare April 23, 2019 12:48
@dmitry-timofeev dmitry-timofeev removed the work-in-progress 👷‍♂️ Do not expect reviewers to provide any feedback on WIP PRs — please ask for it explicitly! label Apr 23, 2019
@dmitry-timofeev dmitry-timofeev changed the title Tap slf4j logs ecr 3139 Update log configurations [ECR-3139] Apr 23, 2019
@dmitry-timofeev dmitry-timofeev requested review from bullet-tooth, MakarovS, skletsun and vitvakatu and removed request for bullet-tooth and MakarovS April 23, 2019 12:59
}

/// The path to `integration_tests` root directory.
fn project_root_dir() -> &'static Path {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have to return a reference? If so when is the object destroyed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to return PathBuf, not &Path.

exonum-java-binding/CHANGELOG.md Outdated Show resolved Hide resolved
@@ -19,7 +19,9 @@ The release is based on Exonum 0.11

### Added
- `toOptional()` method to `EntryIndexProxy`. (#790)
- `getPoolTransactionHashes()` method to `Blockchain`. (#850)
- `getTransactionPool()` method to `Blockchain`. (#850)
- SLF4J to Log4j binding to enable libraries coded to the SLF4J API to use Log4j 2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that "- SLF4J support" is enough in the changelog. Also, I would mention in docs that EJB provides log4j 2 as a logging implementation

@@ -354,6 +354,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it bring to us? We do not use stdout in tests so often.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't, the logger prints to stdout (see the docs)

/// Java logs are needed for debugging purposes.
///
/// It requires the log4j-core library to be present on the classpath, which is the case with fakes.
fn get_log4j_path_option() -> String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

/// The path to `integration_tests` root directory.
fn project_root_dir() -> &'static Path {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to return PathBuf, not &Path.

@dmitry-timofeev dmitry-timofeev added the Next to merge 🛬 The next PR to merge (that is up-to-date with master) label Apr 25, 2019
@dmitry-timofeev dmitry-timofeev merged commit a7be6e8 into exonum:master Apr 25, 2019
@dmitry-timofeev dmitry-timofeev deleted the tap-slf4j-logs-ECR-3139 branch April 25, 2019 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Next to merge 🛬 The next PR to merge (that is up-to-date with master)
Development

Successfully merging this pull request may close these issues.

6 participants