Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
a9dc289d
Commit
a9dc289d
authored
Sep 28, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(LogServer): добавил функцию check() для проверки нормально ли запущен LogServer
(codegen): сделал перезапуск LogServer-а (если он не работает) по команде SysCommand::Logrotate
parent
9f0bf5d2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
3 deletions
+49
-3
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+3
-0
TestGen.cc
Utilities/codegen/tests/TestGen.cc
+2
-1
start_fg.sh
Utilities/codegen/tests/start_fg.sh
+2
-1
LogServer.h
include/LogServer.h
+2
-0
LogServer.cc
src/Log/LogServer.cc
+40
-1
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
a9dc289d
...
...
@@ -474,6 +474,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSysCommand( const SystemMessage*
mylog->logFile(fname.c_str(),true);
mylogany
<<
myname
<<
"(preSysCommand): ***************** mylog LOG ROTATE *****************"
<<
endl;
}
if( logserv
&&
!logserv_host.empty()
&&
logserv_port != 0 )
logserv-
>
check(true);
}
break;
...
...
Utilities/codegen/tests/TestGen.cc
View file @
a9dc289d
...
...
@@ -42,6 +42,7 @@ TestGen::TestGen()
// -----------------------------------------------------------------------------
void
TestGen
::
step
()
{
#if 0
cout << "strval: " << strval(input2_s) << endl;
cout << "str: " << str(input2_s) << endl;
cout << "===========" << endl;
...
...
@@ -53,7 +54,7 @@ void TestGen::step()
int_var++;
bool_var ^= true;
cout << vmon << endl;
#endif
// cout << vmon.pretty_str() << endl;
}
// -----------------------------------------------------------------------------
...
...
Utilities/codegen/tests/start_fg.sh
View file @
a9dc289d
...
...
@@ -3,7 +3,8 @@
ulimit
-Sc
1000000
uniset2-start.sh
-f
./test
--name
TestProc
--confile
test.xml
--ulog-add-levels
warn,crit
\
--test-sm-ready-timeout
15000
--test-run-logserver
--test-log-add-levels
any
$*
--test-sm-ready-timeout
15000
--test-run-logserver
--test-logserver-host
192.192.192.192
#--test-log-add-levels any $*
#info,warn,crit,system,level9 > 1.log
#--c-filter-field cfilter --c-filter-value test1 --s-filter-field io --s-filter-value 1
...
...
include/LogServer.h
View file @
a9dc289d
...
...
@@ -113,6 +113,8 @@ class LogServer:
return
isrunning
;
}
bool
check
(
bool
restart_if_fail
=
true
);
void
init
(
const
std
::
string
&
prefix
,
xmlNode
*
cnode
=
0
);
static
std
::
string
help_print
(
const
std
::
string
&
prefix
);
...
...
src/Log/LogServer.cc
View file @
a9dc289d
...
...
@@ -115,6 +115,45 @@ void LogServer::terminate()
loop
.
evstop
(
this
);
}
// -------------------------------------------------------------------------
bool
LogServer
::
check
(
bool
restart_if_fail
)
{
try
{
// для проверки пробуем открыть соединение..
UTCPSocket
s
(
addr
,
port
);
s
.
close
();
return
true
;
}
catch
(...){}
if
(
!
restart_if_fail
)
return
false
;
if
(
!
sock
)
return
false
;
io
.
stop
();
io
.
set
<
LogServer
,
&
LogServer
::
ioAccept
>
(
this
);
io
.
start
(
sock
->
getSocket
(),
ev
::
READ
);
try
{
UTCPSocket
s
(
addr
,
port
);
s
.
close
();
return
true
;
}
catch
(
Poco
::
Net
::
NetException
&
ex
)
{
ostringstream
err
;
err
<<
myname
<<
"(check): socket error:"
<<
ex
.
message
();
if
(
mylog
.
is_crit
()
)
mylog
.
crit
()
<<
err
.
str
()
<<
endl
;
}
return
false
;
}
// -------------------------------------------------------------------------
void
LogServer
::
evprepare
(
const
ev
::
loop_ref
&
eloop
)
{
if
(
sock
)
...
...
@@ -146,8 +185,8 @@ void LogServer::evprepare( const ev::loop_ref& eloop )
sock
->
setBlocking
(
false
);
io
.
set
<
LogServer
,
&
LogServer
::
ioAccept
>
(
this
);
io
.
set
(
eloop
);
io
.
set
<
LogServer
,
&
LogServer
::
ioAccept
>
(
this
);
io
.
start
(
sock
->
getSocket
(),
ev
::
READ
);
isrunning
=
true
;
}
...
...
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