Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FMDbMonitor_linux
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guanghui.cui
FMDbMonitor_linux
Commits
3831966b
Commit
3831966b
authored
Dec 11, 2017
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志文件:回滚日志前,把日志备份
parent
aaef36b8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
src/FMDbMonitor.cpp
+17
-7
No files found.
src/FMDbMonitor.cpp
View file @
3831966b
...
@@ -33,21 +33,28 @@ INITIALIZE_EASYLOGGINGPP
...
@@ -33,21 +33,28 @@ INITIALIZE_EASYLOGGINGPP
//IOperation *dbOperation; //订单相关操作类
//IOperation *dbOperation; //订单相关操作类
void
app_stopped
(
int
sig
);
//SIGINT(Ctrl + C)
void
app_stopped
(
int
sig
);
//SIGINT(Ctrl + C)
void
logRolloutHandler
(
const
char
*
filename
,
std
::
size_t
size
)
{
/// 备份日志
std
::
string
strLogPath
=
GetProcDir
();
strLogPath
.
append
(
filename
);
std
::
stringstream
ss
;
ss
<<
"mv "
<<
strLogPath
.
data
()
<<
" "
<<
strLogPath
.
data
()
<<
"_bk"
;
system
(
ss
.
str
().
c_str
());
}
int
main
()
int
main
()
{
{
/*HANDLE hObject = CreateMutex(NULL,FALSE,L"FmSingleMonitorConsole");
if(GetLastError() == ERROR_ALREADY_EXISTS)
{
CloseHandle(hObject);
MessageBox(NULL,L"程序已经运行!",NULL,NULL);
return FALSE;
}*/
el
::
Loggers
::
addFlag
(
el
::
LoggingFlag
::
StrictLogFileSizeCheck
);
el
::
Loggers
::
addFlag
(
el
::
LoggingFlag
::
StrictLogFileSizeCheck
);
std
::
string
strLogPath
=
GetProcDir
();
std
::
string
strLogPath
=
GetProcDir
();
strLogPath
.
append
(
"log.conf"
);
strLogPath
.
append
(
"log.conf"
);
el
::
Configurations
conf
(
strLogPath
.
data
());
el
::
Configurations
conf
(
strLogPath
.
data
());
/// 设置全部logger的配置
/// 设置全部logger的配置
el
::
Loggers
::
reconfigureAllLoggers
(
conf
);
el
::
Loggers
::
reconfigureAllLoggers
(
conf
);
/// 注册回调函数
el
::
Helpers
::
installPreRollOutCallback
(
logRolloutHandler
);
InitSystem
();
InitSystem
();
...
@@ -193,6 +200,9 @@ int main()
...
@@ -193,6 +200,9 @@ int main()
//关闭socket
//关闭socket
close
(
sockfd
);
close
(
sockfd
);
}
}
/// 注销回调函数
el
::
Helpers
::
uninstallPreRollOutCallback
();
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment