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

Warning on startup #75

Closed
OLibutzki opened this issue Nov 13, 2016 · 6 comments
Closed

Warning on startup #75

OLibutzki opened this issue Nov 13, 2016 · 6 comments
Labels

Comments

@OLibutzki
Copy link

Pcap4J reports warnings while starting:
2016-11-13 08:51:34.636 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.inet, use default value: null 2016-11-13 08:51:34.640 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.inet6, use default value: null 2016-11-13 08:51:34.640 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.packet, use default value: null 2016-11-13 08:51:34.641 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.link, use default value: null 2016-11-13 08:51:34.790 [WARN ] [org.pcap4j.util.PropertiesLoader ] - [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.dlt.raw, use default value: null

How can I get rid of these warnings without changing the log level?

@kaitoy
Copy link
Owner

kaitoy commented Nov 14, 2016

Set the following system properties before starting a packet capture.

  • org.pcap4j.af.inet to 2
  • org.pcap4j.af.inet6 to
    • 30 if on OSX
    • 28 if on FreeBSD
    • 10 if on Linux
    • 23 otherwise
  • org.pcap4j.af.packet to 17
  • org.pcap4j.af.link to 18
  • org.pcap4j.dlt.raw to
    • 14 if on OpenBSD
    • 12 otherwise

I will change the logs from WARN to INFO in the next version.

@kaitoy kaitoy closed this as completed Nov 14, 2016
@michaelkoetter
Copy link
Contributor

Could this be set automatically in a static block in org.pcap4j.core.Pcaps maybe?
I'd be happy to create a pull request if you think it would be useful :)

@kaitoy
Copy link
Owner

kaitoy commented Dec 3, 2016

I think org.pcap4j.Pcap4jPropertiesLoader should be modified such that its methods use proper default values for loader.getInteger instead of null, rather than setting the system properties.
Also org.pcap4j.util.PropertiesLoader.PropertiesLoader should be changed to log messages with info instead of warn when it uses a default value.
Anyway, pull requests are always useful and helpful.

@kaitoy
Copy link
Owner

kaitoy commented Dec 24, 2016

Merged #78

@kaitoy kaitoy closed this as completed Dec 24, 2016
@kaitoy kaitoy added the enhance label May 25, 2017
@zayeed91
Copy link

Hi Kaitoy
I want to stop that slf4j logs on your library:

Oct 16, 2018 4:48:05 PM org.pcap4j.util.PropertiesLoader getBoolean
INFO: [org/pcap4j/packet/packet.properties] Got"true" which means true by org.pcap4j.packet.udpV4.calcChecksumAtBuild
Oct 16, 2018 4:48:05 PM org.pcap4j.util.PropertiesLoader getBoolean
INFO: [org/pcap4j/packet/packet.properties] Got"true" which means true by org.pcap4j.packet.ipV4.calcChecksumAtBuild
Oct 16, 2018 4:48:05 PM org.pcap4j.core.NativeMappings
INFO: Pcap4J successfully loaded a native pcap library: libpcap version 1.8.1
Oct 16, 2018 4:48:06 PM org.pcap4j.util.PropertiesLoader getInteger
INFO: [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.inet, use default value: 2
Oct 16, 2018 4:48:06 PM org.pcap4j.util.PropertiesLoader getInteger
INFO: [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.inet6, use default value: 10
Oct 16, 2018 4:48:06 PM org.pcap4j.util.PropertiesLoader getInteger
INFO: [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.packet, use default value: 17
Oct 16, 2018 4:48:06 PM org.pcap4j.util.PropertiesLoader getInteger
INFO: [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.af.link, use default value: 18
Oct 16, 2018 4:48:06 PM org.pcap4j.core.Pcaps findAllDevs
INFO: 8 NIF(s) found.
Oct 16, 2018 4:48:06 PM org.pcap4j.util.PropertiesLoader getInteger
INFO: [org/pcap4j/pcap4j.properties] Could not get value by org.pcap4j.dlt.raw, use default value: 12

Please help me.

Thanks
Zayeed

@kaitoy
Copy link
Owner

kaitoy commented Nov 11, 2018

Pcap 4J's logs should be transferred to your logging library (e.g. logback) via SLF4J. Please refer to the logging library's document for information about controlling logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants