-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
DB logger sample #4759
base: main
Are you sure you want to change the base?
DB logger sample #4759
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality ok, but it should be tidied up a bit, there's too much functionality crammed into a single class. Something along these lines:
poco/Util/samples/SampleServer/src/SampleServer.cpp
Lines 108 to 112 in c8dade8
TaskManager tm; | |
tm.start(new SampleTask); | |
waitForTerminationRequest(); | |
tm.cancelAll(); | |
tm.joinAll(); |
Extracted scanning and inserting functionality to a separate class Is that what you had in mind by tidying up? |
60ac4fc
to
67c39e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to have DBLogger.properties
file, with all the commend option settings and logger settings, something like this:
logging.loggers.root.channel = appSplitter
logging.loggers.root.level = information
logging.channels.appFile.class = FileChannel
logging.channels.appFile.pattern = %L%Y-%m-%d %H:%M:%S.%i [%p] %s<%I>: %t
logging.channels.appFile.path = ${application.baseName}.log
logging.channels.appFile.times = local
logging.channels.appFile.rotation = daily
logging.channels.appFile.archive = number
logging.channels.appFile.purgeCount = 10
logging.channels.sql.class = SQLChannel
logging.channels.sql.name = DBLogger
logging.channels.sql.connector = SQLite
logging.channels.sql.connect = DBLogger.db3
logging.channels.sql.timeout = 3000
logging.channels.sql.minBatch = 5
logging.channels.sql.maxBatch = 1000
logging.channels.sql.bulk = true
logging.channels.sql.table = T_LOG
logging.channels.sql.async = false
logging.channels.sql.throw = false
logging.channels.sql.file = ${application.baseName}.sql
logging.channels.console.class = ColorConsoleChannel
logging.channels.console.pattern = %L%Y-%m-%d %H:%M:%S.%i [%p] %s<%I>: %t
logging.channels.appSplitter.class = SplitterChannel
logging.channels.appSplitter.channels = console, appFile, sql
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Sample should work out of the box, but it doesn't:
$ bin/Linux/aarch64/DBLogger
Directory:
Database: ,
Number of workers: 2
Not found
Created 0 messages, processed 0 messages in 0 ms.
-
There should be a reasonable initial default setup so that workers can keep up with sql file generation; as it is now, the filesystem gets clogged with sql files.
-
logging configuration, as mentioned here
-
SQL statements in the files should insert more than a single row; should be achievable with
minBatch
property
e627a51
to
94ebcfa
Compare
@aleks-f : Is it a matter of SQL channel configuration to insert multiple SQL statements into the same file or shall DB logger have its own configuration to merge multiple sql files together? |
Number of rows inserted in one statement should be controllable with Lines 56 to 58 in cb91880
The Lines 400 to 408 in cb91880
See eg. |
Thanks, the latest code uses |
Resolves #4750