Download the PHP package tourze/json-rpc-log-bundle without Composer
On this page you can find all versions of the php package tourze/json-rpc-log-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package json-rpc-log-bundle
JsonRPC Log Bundle
中文
[]
(https://packagist.org/packages/tourze/json-rpc-log-bundle)
[
]
(https://packagist.org/packages/tourze/json-rpc-log-bundle)
[
]
(https://packagist.org/packages/tourze/json-rpc-log-bundle)
[
]
(https://github.com/tourze/php-monorepo/actions)
[
]
(https://codecov.io/gh/tourze/php-monorepo)
A Symfony bundle for comprehensive JsonRPC server logging with async database storage, performance monitoring, and seamless integration with the Tourze ecosystem.
Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Configure Log Retention
- Access Admin Interface
- Configuration Options
- Environment Variables
- Advanced Usage
- Database Schema
- Testing
- Security
- Contributing
- License
- Changelog
Features
- Automatic Request/Response Logging: Log JsonRPC requests, responses, and exceptions to database
- Async Database Storage: High-performance async insertion using Doctrine
- Performance Monitoring: Stopwatch timing and execution metrics
- Event-Driven Architecture: Extensible logging through event subscribers
- Admin Interface: Built-in EasyAdmin CRUD for log management
- Automatic Cleanup: Configurable log retention policies
- Rich Context: Captures IP, User-Agent, User info, and more
- Flexible Configuration: Control logging via attributes and environment variables
Requirements
- PHP >= 8.1
- Symfony >= 6.4
- Doctrine ORM
Installation
Install via Composer
Required Dependencies
The bundle integrates with several Tourze ecosystem packages:
tourze/doctrine-async-insert-bundle- Async database operationstourze/doctrine-snowflake-bundle- Snowflake ID generationtourze/json-rpc-core- Core JsonRPC functionality
Database Setup
Run migrations to create the required database tables:
Quick Start
1. Enable Logging on JsonRPC Procedures
Configure Log Retention
Set environment variables in your .env file:
Access Admin Interface
Once configured, access the JsonRPC logs through your admin panel:
- Navigate to "System Monitoring" → "JsonRPC Logs"
- View, filter, and export log entries
- Monitor performance metrics and errors
Configuration Options
Log Attributes
Control what gets logged using the #[Log] attribute:
Environment Variables
| Variable | Description | Default |
|---|---|---|
JSON_RPC_LOG_PERSIST_DAY_NUM |
Days to keep logs before cleanup | 180 |
JSON_RPC_LOG_RESULT_LENGTH |
Maximum length of logged response | 1000 |
Advanced Usage
Custom Log Formatting
Implement custom log formatting by creating a service that implements LogFormatProcedure:
Monolog Integration
The bundle includes a Monolog processor that adds JsonRPC payload to log context:
Performance Monitoring
Each logged request includes:
- Execution time (stopwatch)
- Memory usage
- Request/response size
- Error details (if any)
Database Schema
The bundle creates a json_rpc_log table with the following key fields:
id- Snowflake ID (primary key)request_id- JsonRPC request IDmethod- JsonRPC method namerequest_payload- Request data (JSON)response_payload- Response data (JSON)exception_message- Error details (if any)duration- Execution time in millisecondsclient_ip- Client IP addressserver_ip- Server IP addressuser_agent- Client User-Agentuser_id- Associated user (if authenticated)created_at- Timestamp
Testing
Run the test suite:
The bundle includes comprehensive tests covering:
- Attribute functionality
- Event subscribers
- Database entities
- Admin controllers
- Service integration
Security
This bundle handles sensitive request/response data. Consider:
- Review logged data types and implement appropriate data sanitization
- Configure proper log retention policies for compliance
- Secure admin interface access with appropriate role-based permissions
- Consider encrypting sensitive log data at rest
Contributing
- Submit issues via GitHub
- Pull requests welcome, follow PSR-12 code style
- Ensure all tests pass before submitting
- Add tests for new features
License
MIT License. Copyright (c) tourze
Changelog
See CHANGELOG for version history and upgrade notes.
All versions of json-rpc-log-bundle with dependencies
doctrine/dbal Version ^4.0
doctrine/doctrine-bundle Version ^2.13
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
easycorp/easyadmin-bundle Version ^4
knplabs/knp-menu Version ^3.7
monolog/monolog Version ^3.1
nesbot/carbon Version ^2.72 || ^3
psr/log Version ^3|^2|^1
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/event-dispatcher Version ^7.3
symfony/event-dispatcher-contracts Version ^3
symfony/framework-bundle Version ^7.4
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
symfony/serializer Version ^7.3
symfony/service-contracts Version ^3.6
symfony/stopwatch Version ^7.3
symfony/yaml Version ^7.3
tourze/backtrace-helper Version 1.*
tourze/bundle-dependency Version 1.*
tourze/doctrine-async-insert-bundle Version 1.0.*
tourze/doctrine-helper Version 1.0.*
tourze/doctrine-indexed-bundle Version 1.0.*
tourze/doctrine-ip-bundle Version 1.1.*
tourze/doctrine-snowflake-bundle Version 1.1.*
tourze/doctrine-timestamp-bundle Version 1.1.*
tourze/doctrine-user-agent-bundle Version 1.0.*
tourze/doctrine-user-bundle Version 1.0.*
tourze/easy-admin-menu-bundle Version 1.0.*
tourze/json-rpc-core Version 2.0.*
tourze/symfony-dependency-service-loader Version 1.0.*
tourze/symfony-schedule-entity-clean-bundle Version 1.1.*
yiisoft/json Version ^1.0
yiisoft/strings Version ^2.1