Access log: What options do you need? #169
Replies: 7 comments 3 replies
-
Something related: What about making the |
Beta Was this translation helpful? Give feedback.
-
Small progress update 1 now that PR #174 has been merged 🎉 This changeset makes the existing <?php
require __DIR__ . '/../vendor/autoload.php';
$app = new FrameworkX\App(
new FrameworkX\AccessLogHandler(),
new FrameworkX\ErrorHandler()
);
// Register routes here, see routing…
$app->run(); This is a starting point to add more options to control access logging in follow-up PRs as discussed here. |
Beta Was this translation helpful? Give feedback.
-
Small progress update 2 now that PR #175 has been merged 🎉 This changeset adds support for loading the <?php
require __DIR__ . '/../vendor/autoload.php';
$app = new FrameworkX\App(
FrameworkX\AccessLogHandler::class,
FrameworkX\ErrorHandler::class
);
// Register routes here, see routing…
$app->run(); On top of this, you may now configure the default handlers with an explicit DI container configuration like this: <?php
require __DIR__ . '/../vendor/autoload.php';
$container = new FrameworkX\Container([
FrameworkX\AccessLogHandler::class => fn () => new FrameworkX\AccessLogHandler()
]);
$app = new FrameworkX\App($container);
// Register routes here, see routing…
$app->run(); This is the next step in adding more options to control access logging and error handling in follow-up PRs as discussed here. |
Beta Was this translation helpful? Give feedback.
-
At the moment, the I wonder if we can relax this requirement and if so how, how should the I agree that being required to always pass an |
Beta Was this translation helpful? Give feedback.
-
It would be useful if we could use a custom log format and specify custom variables to write as part of the access log. For instance, we might be able to reuse variable names used elsewhere, e.g. nginx: http://nginx.org/en/docs/varindex.html. However, may want to provide additional variables e.g. for datetimes with millisecond or microsecond precision (only available through some hacks in nginx: https://thatsamguy.com/nginx-iso8601-time-format/)
The idea is to start with some predefined variables to cover most common use cases and allow users to pass in custom variables. For instance, #177/#172 allows overriding the |
Beta Was this translation helpful? Give feedback.
-
Progress update: @clue filed a pull request (#247) adding support for configuring a specific log file path. This can be achieved by passing an argument to the <?php
require __DIR__ . '/../vendor/autoload.php';
$container = new FrameworkX\Container([
'accesslog' => __DIR__ . '/../logs/access.log',
FrameworkX\AccessLogHandler::class => fn(string $accesslog) => new FrameworkX\AccessLogHandler($accesslog)
]);
$app = new FrameworkX\App($container);
// … This feature is the next step to introduce more options to control access logging and will be a part of the upcoming release of our first Framework X version (see https://twitter.com/x_framework/status/1762499173830778907). If you enjoy our efforts and want to help us continue doing what we love, consider showing your support by leaving a sponsorship ❤️ I'll keep this ticket updated as we make progress with follow-up PRs 👍 |
Beta Was this translation helpful? Give feedback.
-
Progress update: After we added support for configuring a specific log file path in #247, we now improved the overall performance when specifically skipping the This can be easily reproduced by running a benchmark against any of the examples like this: $ php public/index.php >/dev/null
$ docker run -it --rm --net=host jordi/ab -n100000 -c100 -k http://localhost:8080/
# old: 22678 requests per second
# new: 29232 requests per second If you enjoy our efforts and want to help us continue doing what we love, consider showing your support by leaving a sponsorship ❤️ |
Beta Was this translation helpful? Give feedback.
-
Our plan is to add more control over the
AccessLogHandler
thus giving the access log more configuration options. This way you can customize the information of your access log. The only questions now is: What should be configurable options for this and what should be defaults for each option? What information do you want to log and why?Our current access log looks like this:
@clue and I already discussed this topic a bit and came up with a few ideas (log file, log format, etc.), we're interested to hear about your input!
Beta Was this translation helpful? Give feedback.
All reactions