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 request log to log configuration #4755

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

line-o
Copy link
Member

@line-o line-o commented Feb 16, 2023

Description:

With the update to jetty 11 request logs are now implicitly written to exist.log (the exist.core appender to be more accurate).
This PR adds the requestLogger explicitly to the log4j configuration along with some comments.

        <!--
            the requestlog was previously written into separate files
            if you want to retain that you need to add a new appender
            and change the AppenderRef to reference it here
        -->
        <Logger name="org.eclipse.jetty.server.RequestLog" additivity="false" level="info">
            <AppenderRef ref="STDOUT"/>
            <AppenderRef ref="exist.core"/><!-- request log is now written to exist.log -->
        </Logger>

It also appends the request log to STDOUT so that when existdb is started on the command line those requests will
be available right after the notification that jetty has started:

16 Feb 2023 12:51:10,904 [main] INFO  (JettyStart.java [startJetty]:478) - [Starting jetty component : org.eclipse.jetty.server.Server]
16 Feb 2023 12:51:10,904 [main] INFO  (JettyStart.java [lifeCycleStarting]:635) - Jetty server starting...
16 Feb 2023 12:51:11,409 [main] INFO  (JettyStart.java [lifeCycleStarted]:644) - Jetty server started.
16 Feb 2023 12:51:11,409 [main] INFO  (JettyStart.java [run]:288) - -----------------------------------------------------
16 Feb 2023 12:51:11,410 [main] INFO  (JettyStart.java [run]:289) - Server has started, listening on:
16 Feb 2023 12:51:11,410 [main] INFO  (JettyStart.java [run]:291) - http://127.0.0.1:8080/
16 Feb 2023 12:51:11,410 [main] INFO  (JettyStart.java [run]:291) - https://127.0.0.1:8443/
16 Feb 2023 12:51:11,410 [main] INFO  (JettyStart.java [run]:294) - Configured contexts:
16 Feb 2023 12:51:11,410 [main] INFO  (JettyStart.java [run]:300) - /exist (eXist XML Database)
16 Feb 2023 12:51:11,411 [main] INFO  (JettyStart.java [run]:300) - / (eXist-db portal)
16 Feb 2023 12:51:11,411 [main] INFO  (JettyStart.java [run]:324) - -----------------------------------------------------
16 Feb 2023 12:51:18,272 [qtp536994956-44] INFO  (Slf4jRequestLogWriter.java [write]:57) - 127.0.0.1 - - [16/Feb/2023:11:51:18 +0000] "GET /exist/apps/eXide/index.html HTTP/1.1" 200 54409 "-" "curl/7.79.1"

Reference:

change introduced in c7083be

Type of tests:

none

@line-o line-o requested a review from a team February 16, 2023 12:31
@duncdrum
Copy link
Contributor

@line-o just out of curiosity have you actually been able to confirm that the old request.logs no longer exist? I'd hate for us to log this stuff in two locations

@line-o
Copy link
Member Author

line-o commented Feb 16, 2023

@duncdrum since the old configuration for jetty request logs was replaced I am sure the old log files are no more.

@line-o
Copy link
Member Author

line-o commented Feb 16, 2023

@duncdrum also out of curiosity: what are the implications on running existdb in docker when it comes to request logs appended to exist.log and/or STDOUT?

@line-o line-o added needs documentation Signals issues or PRs that will require an update to the documentation repo enhancement new features, suggestions, etc. labels Feb 16, 2023
@line-o line-o changed the title [fix] add request log to configuration Add request log to log configuration Feb 16, 2023
@duncdrum
Copy link
Contributor

duncdrum commented Feb 16, 2023

none really, write access to the container filesystem is the same irrespective of path or filename. Since this is easily user configurable its just a question of what you prefer as a default. Personally i m leaning towards just logging to standard out, and leave the files alone.

@line-o
Copy link
Member Author

line-o commented Feb 21, 2023

From yesterdays community call:

While it is generally good to have as few separate log files as possible (preferably just one), I think that the jetty request log with one line per request is excessive. This will flood the default logs. In general we could see the upcoming major version as an opportunity to rethink the log setup.
@reinhapa

@sonarcloud
Copy link

sonarcloud bot commented Feb 21, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@duncdrum
Copy link
Contributor

duncdrum commented Feb 21, 2023

While I share @reinhapa 's concern about flooding the exist.log file, previously the requests where logged by jetty in a separate location, that wasn't user accessible and equally verbose. We already have a number of *.log files pre-configured for exist, that receive little to no entries. Creating another one, or reusing one of the existing logs for the requests is a good feature to tackle for v7.

Yet, getting the requests to be logged within the log4j logs that control all this in the first place, is a precondition and a separate step in my mind. So I would merge this PR first, and tackle the broader refactoring of the default logs later.

Copy link
Contributor

@duncdrum duncdrum left a comment

Choose a reason for hiding this comment

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

As mentioned in the discussion. This is a good first step. But likely requires fine tuning afterwards. Good to go into develop from my side

@adamretter
Copy link
Member

I don't think this is ready yet. There should be a jetty request log in the same way we previously had, I'm not certain that log4j is the correct place to handle this. Instead we may just need a tweak to the jetty config files (if something changed around lodging config between jetty 9 and 11)

@joewiz
Copy link
Member

joewiz commented Jul 17, 2023

As discussed in today's Community Call, we should resolve the request logging situation before the release of eXist 7, since users expect request logs to be stored in logs/YYYY_MM_DD.request.log and not to appear in exist.log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new features, suggestions, etc. needs documentation Signals issues or PRs that will require an update to the documentation repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants