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

Add an external Log4J2 configuration file #1031

Merged
merged 1 commit into from
Nov 5, 2020
Merged

Add an external Log4J2 configuration file #1031

merged 1 commit into from
Nov 5, 2020

Conversation

dadoonet
Copy link
Owner

@dadoonet dadoonet commented Nov 5, 2020

FSCrawler comes with a default logger configuration which can be found in the FSCrawler installation dir as config/log4j2.xml file.

You can modify it to suit your needs.

You can control where FSCrawler will store the logs by setting the LOG_DIR Java property.

FS_JAVA_OPTS="-DLOG_DIR=path/to/logs_dir" bin/fscrawler

By default, it will log everything in the logs directory inside the installation folder.

Two log files are generated:

  • One is used to log FSCrawler code execution, named fscrawler.log. It's automatically
    rotated every day or after 20mb of logs and gzipped. Logs are removed after 7 days.
  • One is used to trace all information about documents, named documents.log. It's automatically
    rotated every day or after 20mb of logs and gzipped. Logs are removed after 7 days.

You can change this strategy by modifying the config/log4j2.xml file.
Please read Log4J2 documentation on how to configure Log4J.

Closes #536.
Closes #1028.

FSCrawler comes with a default logger configuration which can be found in the FSCrawler installation dir as `config/log4j2.xml` file.

You can modify it to suit your needs.

You can control where FSCrawler will store the logs by setting the `LOG_DIR` Java property.

```sh
FS_JAVA_OPTS="-DLOG_DIR=path/to/logs_dir" bin/fscrawler
```

By default, it will log everything in the `logs` directory inside the installation folder.

Two log files are generated:

* One is used to log FSCrawler code execution, named `fscrawler.log`. It's automatically
rotated every day or after 20mb of logs and gzipped. Logs are removed after 7 days.
* One is used to trace all information about documents, named `documents.log`. It's automatically
rotated every day or after 20mb of logs and gzipped. Logs are removed after 7 days.

You can change this strategy by modifying the `config/log4j2.xml` file.
Please read [Log4J2 documentation](https://logging.apache.org/log4j/2.x/manual/index.html) on how to configure Log4J.

Closes #536.
Closes #1028.
@dadoonet dadoonet added the new For new features or options label Nov 5, 2020
@dadoonet dadoonet added this to the 2.7 milestone Nov 5, 2020
@dadoonet dadoonet self-assigned this Nov 5, 2020
@sonarcloud
Copy link

sonarcloud bot commented Nov 5, 2020

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 3 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (1.8.0_252) you have used to run this analysis is deprecated and we will stop accepting it accepting it soon.Please update to at least Java 11.
Read more here

@dadoonet dadoonet merged commit e90e158 into master Nov 5, 2020
@dadoonet dadoonet deleted the pr/logger branch November 5, 2020 19:56
dadoonet added a commit that referenced this pull request Nov 6, 2020
We change the way we are logging in `documents.log`:

* `INFO` level by default instead of `DEBUG`.
* Add the document `_id` to the log
* Add the documentLogger to the BulkListeners so we at least trace which `_id` has failed

Follow up for #1031
dadoonet added a commit that referenced this pull request Nov 9, 2020
Simplify `log4j2.xml` for the end user. Now you can control where FSCrawler will store the logs and the log levels by setting `LOG_DIR`, `LOG_LEVEL` and `DOC_LEVEL` Java properties.

```sh
   FS_JAVA_OPTS="-DLOG_DIR=path/to/logs_dir -DLOG_LEVEL=trace -DDOC_LEVEL=debug" bin/fscrawler
```

In the future we might remove the `--debug` and `--trace` CLI options.

Also adds a banner! :)

Follow up for #1031
dadoonet added a commit that referenced this pull request Dec 11, 2023
As we are supporting now the standard way for logging (see #1031), we can remove support for `--debug` and `--trace`.

Instead users can use:

```sh
FS_JAVA_OPTS="-DLOG_LEVEL=debug" bin/fscrawler
```

or

```sh
FS_JAVA_OPTS="-DLOG_LEVEL=trace" bin/fscrawler
```

That's producing the same effect at the end in a much more standard way.
dadoonet added a commit that referenced this pull request Dec 12, 2023
As we are supporting now the standard way for logging (see #1031), we can remove support for `--debug` and `--trace`.

Instead users can use:

```sh
FS_JAVA_OPTS="-DLOG_LEVEL=debug" bin/fscrawler
```

or

```sh
FS_JAVA_OPTS="-DLOG_LEVEL=trace" bin/fscrawler
```

That's producing the same effect at the end in a much more standard way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new For new features or options
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a document error logger Generate logs in fscrawler
1 participant