Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

print out line number in log info. #1362

Merged
merged 7 commits into from
Mar 4, 2019

Conversation

lhfbc
Copy link
Contributor

@lhfbc lhfbc commented Feb 26, 2019

Description

print out the line number in log info. It will be convenient for debugging.

For example, the output will be changed from

02/26 19:25:04.039 [main] INFO com.iota.iri.IRI$IRILauncher - Welcome to IRI Testnet 1.6.1-RELEASE

to

02/26 19:25:04.039 [main] INFO com.iota.iri.IRI$IRILauncher:117 - Welcome to IRI Testnet 1.6.1-RELEASE

Fixes #1361

Type of change

  • Enhancement (a non-breaking change which adds functionality)

How Has This Been Tested?

compare the log output between before and after modification.

Checklist:

  • My code follows the style guidelines for this project
  • I have performed a self-review of my own code

@GalRogozinski
Copy link
Contributor

I think it makes the log a bit ugly, but maybe others will disagree.
@kwek20 what do you think?

@lhfbc
Copy link
Contributor Author

lhfbc commented Feb 27, 2019

I think it makes the log a bit ugly, but maybe others will disagree.
@kwek20 what do you think?

In the future, if the number of code in IOTA is growing really fast, and there are distributed deployment, without the line number, it will be really inefficient to triage bugs. That's my opinion.

@th0br0
Copy link
Contributor

th0br0 commented Feb 27, 2019

You could truncate the classname given the common prefix (com.iota.iri => iri) which would reduce the impact of this. Given the rather long files we have occasionally this might make sense?

@GalRogozinski
Copy link
Contributor

I agree with @th0br0
@lhfbc wants to do it?

@lhfbc
Copy link
Contributor Author

lhfbc commented Feb 27, 2019

I agree with @th0br0
@lhfbc wants to do it?

Yes.
I have 2 options:
"02/27 17:36:13.670 [main] INFO IRI.java:117 - Welcome to IRI Testnet 1.6.1-RELEASE"
or
"02/27 17:29:49.463 [main] INFO IRI$IRILauncher:117 - Welcome to IRI Testnet 1.6.1-RELEASE"

The first will be the file name, but every file will have a suffix ".java".
And the second will be the class name, where 'IRILauncher' is a private class in 'IRI', with '$' splitting them.

Which one will be better?

@GalRogozinski
Copy link
Contributor

Definitely the second one

@legacycode
Copy link
Contributor

legacycode commented Feb 27, 2019

+1 for the second one. I like the line numbers.

@lhfbc
Copy link
Contributor Author

lhfbc commented Mar 1, 2019

Hello, @GalRogozinski @legacycode @th0br0, would you please review the code?

Copy link
Contributor

@legacycode legacycode left a comment

Choose a reason for hiding this comment

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

LGTM:

03/01 07:09:42.244 [main] INFO  IRI$IRILauncher:176 - Configuration is created using command line args only
03/01 07:09:42.262 [main] INFO  IRI$IRILauncher:177 - parsed the following cmd args: [--testnet, -p, 14265, --remote]
03/01 07:09:42.264 [main] INFO  IRI$IRILauncher:111 - Welcome to IRI Testnet 1.6.0-RELEASE
03/01 07:09:43.741 [main] INFO  RocksDBPersistenceProvider:62 - Initializing Database on spent-addresses-db
03/01 07:09:44.287 [main] INFO  RocksDBPersistenceProvider:65 - RocksDB persistence provider initialized.
03/01 07:09:44.288 [main] INFO  LatestMilestoneTrackerImpl:168 - Latest milestone has changed from #0 to #434525
03/01 07:09:44.723 [main] INFO  RocksDBPersistenceProvider:62 - Initializing Database on testnetdb
03/01 07:09:44.753 [main] INFO  RocksDBPersistenceProvider:65 - RocksDB persistence provider initialized.
03/01 07:09:44.758 [main] INFO  UDPReceiver:53 - UDP replicator is accepting connections on udp port 14600
03/01 07:09:44.759 [main] INFO  Replicator:42 - Started ReplicatorSourcePool
03/01 07:09:44.759 [UDP receiving thread] INFO  UDPReceiver:63 - Spawning Receiver Thread

@lhfbc
Copy link
Contributor Author

lhfbc commented Mar 4, 2019

@GalRogozinski @kwek20 @legacycode @th0br0, would anyone of you like to merge it? This pr has been lasting for many days ... :)

@GalRogozinski GalRogozinski merged commit cb08095 into iotaledger:dev Mar 4, 2019
@jakubcech jakubcech mentioned this pull request May 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants