Skip to content
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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Data/SQLite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ else()
POCO_SOURCES(SQLITE_SRCS sqlite3
src/sqlite3.c
)

POCO_HEADERS(SQLITE_SRCS sqlite3
src/sqlite3.h
)
endif()

# Version Resource
Expand Down
1 change: 1 addition & 0 deletions Data/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ add_subdirectory(RowFormatter)
add_subdirectory(Tuple)
add_subdirectory(TypeHandler)
add_subdirectory(WebNotifier)
add_subdirectory(DBLogger)
14 changes: 14 additions & 0 deletions Data/samples/DBLogger/CMakeLists.txt
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)
11 changes: 11 additions & 0 deletions Data/samples/DBLogger/DBLogger.progen
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
67 changes: 67 additions & 0 deletions Data/samples/DBLogger/DBLogger.properties
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

663 changes: 663 additions & 0 deletions Data/samples/DBLogger/DBLogger_vs160.vcxproj

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions Data/samples/DBLogger/DBLogger_vs160.vcxproj.filters
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>
978 changes: 978 additions & 0 deletions Data/samples/DBLogger/DBLogger_vs170.vcxproj

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions Data/samples/DBLogger/DBLogger_vs170.vcxproj.filters
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>
Loading
Loading