-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* sample(DBLogger): New sample to demonstrate DB logging to a file. (#4750) * sample(DBLogger): Create messages via SQL logger in a thread (#4750) * sample(DBLogger): Save messages from SQL files to an SQL database (works with SQLite) (#4750) * chore(Makefile): Data samples depend on PocoUtil (#4750) * sample(DBLogger): Refactored DBLogger with std::filesystem::directory_iterator and std::thread. * sample(DBLogger): Add missing include <condition_variable> * sample(DBLogger): Extracted log scanning and inserting functionality to class SQLLogInserter. * sample(DBLogger): Create new logging table only when using demo messages option. * feat(DBLogger): VS projects * sample(DBLogger): Acquire options from configuration file. * feat(DBLogger): regenerate VS projects (progen file change) * sample(DBLogger): Add example DBLogger.properties file. * sample(DBLogger): Process as much as possible when stopping processing. * sample(DBLogger): Meaningful defaults in properties file. * sample(DBLogger): Verify validity of database session on startup. * sample(DBLogger): Configure demo SQL channel in properties file. * chore(DBLogger): style and warnings --------- Co-authored-by: Aleksandar Fabijanic <[email protected]> Co-authored-by: Alex Fabijanic <[email protected]>
- Loading branch information
1 parent
2815ea4
commit 52959b9
Showing
21 changed files
with
3,208 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
# Sources | ||
file(GLOB SRCS_G "src/*.cpp") | ||
POCO_SOURCES_AUTO(DBLOGGER_SRCS ${SRCS_G}) | ||
|
||
# Headers | ||
file(GLOB_RECURSE HDRS_G "src/*.h") | ||
POCO_HEADERS_AUTO(DBLOGGER_SRCS ${HDRS_G}) | ||
|
||
add_executable(DBLogger ${DBLOGGER_SRCS}) | ||
|
||
target_link_libraries(DBLogger PUBLIC Poco::Util Poco::DataSQLite) | ||
|
||
add_custom_target(DBLogger-properties SOURCES DBLogger.properties) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
vc.project.guid = ${vc.project.guidFromName} | ||
vc.project.name = ${vc.project.baseName} | ||
vc.project.target = ${vc.project.name} | ||
vc.project.type = executable | ||
vc.project.pocobase = ..\\..\\.. | ||
vc.project.platforms = Win32 | ||
vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md | ||
vc.project.prototype = ${vc.project.name}_vs90.vcproj | ||
vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\JSON\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Data\\include;..\\..\\..\\Data\\SQLParser;..\\Data\\SQLParser\\src;..\\..\\..\\Data\\SQLite\\include | ||
vc.project.compiler.additionalOptions = /Zc:__cplusplus | ||
vc.project.linker.dependencies = iphlpapi.lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
|
||
# | ||
# Database inserter (destination) | ||
# | ||
|
||
# | ||
# Destination database parameters: | ||
# | ||
# (Mandatory) Database connector (for example sqlite) | ||
# | ||
DBLogger.connector = sqlite | ||
|
||
# | ||
# (Mandatory) Database connection string (connector specific) | ||
# | ||
DBLogger.constring = demo-logs.db3 | ||
|
||
# | ||
# (Optional) Number of workers to insert logs into the database in parallel (default = 2) | ||
# | ||
# DBLogger.workers = 2 | ||
|
||
# ---------------------------------------------------------------- | ||
|
||
# | ||
# (Optional) Create demo SQL messages for testing purposes (default = false) | ||
# | ||
DBLogger.demo = true | ||
|
||
logging.loggers.root.channel = console | ||
logging.loggers.root.level = information | ||
|
||
logging.channels.console.class = ColorConsoleChannel | ||
logging.channels.console.pattern = %L%Y-%m-%d %H:%M:%S.%i [%p] : %t | ||
|
||
# | ||
# SQL logger to create demo messages | ||
# NOTE: Do not rename the logger. | ||
# | ||
|
||
logging.loggers.sqldemo.channel = sql | ||
logging.loggers.sqldemo.name = SQLDemo | ||
logging.loggers.sqldemo.level = debug | ||
|
||
logging.channels.sql.class = SQLChannel | ||
logging.channels.sql.name = DBLogger | ||
|
||
# | ||
# (Mandatory) Directory to scan for .sql files | ||
# | ||
logging.channels.sql.directory = . | ||
|
||
# | ||
# NOTE: Do not configure database to create SQL logger files | ||
# | ||
# 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.throw = false | ||
logging.channels.sql.file = ${application.baseName}.sql | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{8747f452-7c1b-44d2-b0e5-1681f3dab78e}</UniqueIdentifier> | ||
</Filter> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{f73ed930-0047-402d-8e77-3b9b9ddbc3a7}</UniqueIdentifier> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="src\SQLLogInserter.cpp" /> | ||
<ClCompile Include="src\DBLogger.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
</Project> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{b2b53da4-c45b-4734-9096-6c64453817a6}</UniqueIdentifier> | ||
</Filter> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{654b0a83-74d5-4a84-b813-6493ce240b90}</UniqueIdentifier> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="src\SQLLogInserter.cpp" /> | ||
<ClCompile Include="src\DBLogger.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.