Skip to content

Commit

Permalink
[issue #153] update commandline samples to use file-leak-detector-jar…
Browse files Browse the repository at this point in the history
…-with-dependencies.jar, added sample for permanent logging (#156)
  • Loading branch information
WolfgangHG authored Sep 27, 2023
1 parent ff184cc commit ab917b3
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,36 @@ Without any options, this tool silently records file open/close operations and u

[source,sh]
----
$ java -javaagent:path/to/file-leak-detector.jar ...your usual Java arguments follow...
$ java -javaagent:path/to/file-leak-detector-jar-with-dependencies.jar ...your usual Java arguments follow...
----

There are several options you can pass to the agent.
For example, to dump the open file descriptors when the total number reaches 200, you can do the following:

[source,sh]
----
$ java -javaagent:path/to/file-leak-detector.jar=threshold=200 ...your usual Java arguments follow...
$ java -javaagent:path/to/file-leak-detector-jar-with-dependencies.jar=threshold=200 ...your usual Java arguments follow...
----

Continuous logging of every opened/closed file:

[source,sh]
----
$ java -javaagent:path/to/file-leak-detector-jar-with-dependencies.jar=trace=/path/to/logfile.txt ...your usual Java arguments follow...
----

Or to have it run a mini HTTP server so that you can access the information from your browser, do the following and open http://localhost:19999/:

[source,sh]
----
$ java -javaagent:path/to/file-leak-detector.jar=http=19999 ...your usual Java arguments follow...
$ java -javaagent:path/to/file-leak-detector-jar-with-dependencies.jar=http=19999 ...your usual Java arguments follow...
----

Use the help option to see the help screen for the complete list of options:

[source,sh]
----
$ java -javaagent:path/to/file-leak-detector.jar=help
$ java -javaagent:path/to/file-leak-detector-jar-with-dependencies.jar=help
----

== Attaching after JVM startup
Expand All @@ -57,7 +64,7 @@ Options can be specified in the second argument in the same format you do to the

[source,sh]
----
$ java -jar path/to/file-leak-detector.jar 1500 threshold=200,strong
$ java -jar path/to/file-leak-detector-jar-with-dependencies.jar 1500 threshold=200,strong
----

== Supported options
Expand Down

0 comments on commit ab917b3

Please sign in to comment.