Log::Log4perl::Appender::Chunk::Store - Store adapter baseclass
This is the baseclass for all Store adapters used by the Log::Log4perl::Appender::Chunk appender.
Make a Moose subclass of this and implement the 'store' method.
Have a look at the minimalistic code in Log::Log4perl::Appender::Chunk::Store::Memory.
Settings:
Settings should be plain Scalar Moose attributes. They will be injected from the configuration file key 'store_args'.
Set the store_class property of your Chunk appender to something like:
log4perl.appender.Chunk.store_class=+My::L4p::Appender::Chunk::Store::MyStorage
Remember you can set some your storage class parameters like:
log4perl.appender.Chunk.store_args.my_setting1=Setting1Value log4perl.appender.Chunk.store_args.my_setting2=Setting2Value
If your Storage is too complex to build itself only from the configuration file properties, you can perfectly build an instance of it and inject it in your Chunk Appender at run time (do that only once right after L4P init):
my $store = .. An instance of your My::L4p::Appender::Chunk::Store::MyStorage if( my $chunk_appender = Log::Log4perl->appender_by_name('Chunk') ){ $chunk_appender->store($store); }
Don't forget to change 'Chunk' by whatever name you gave to your Chunk appender in the config file.
This method will be called by the Log::Log4perl::Appender::Chunk to store a whole chunk of log lines under the given chunk ID.
Implement it in any subclass like:
sub store{ my ($self, $chunk_id, $chunk) = @_; ... }
To install Log::Log4perl::Appender::Chunk, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Log4perl::Appender::Chunk
CPAN shell
perl -MCPAN -e shell install Log::Log4perl::Appender::Chunk
For more information on module installation, please visit the detailed CPAN module installation guide.