Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
7
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a634f5ce
authored
Jul 28, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agent-winservice: add file logging
parent
035f93af
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
agent-winservice.py
+16
-3
No files found.
agent-winservice.py
View file @
a634f5ce
import
win32serviceutil
import
win32service
import
win32event
import
logging
import
os
import
servicemanager
import
socket
import
win32event
import
win32service
import
win32serviceutil
from
agent
import
main
as
agent_main
,
reactor
logger
=
logging
.
getLogger
()
fh
=
logging
.
FileHandler
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"agent-service.log"
))
formatter
=
logging
.
Formatter
(
"
%(asctime)
s -
%(name)
s [
%(levelname)
s]
%(message)
s"
)
fh
.
setFormatter
(
formatter
)
logger
.
addHandler
(
fh
)
logger
.
info
(
"
%
s loaded"
,
__file__
)
class
AppServerSvc
(
win32serviceutil
.
ServiceFramework
):
_svc_name_
=
"circle-agent"
...
...
@@ -20,11 +31,13 @@ class AppServerSvc (win32serviceutil.ServiceFramework):
self
.
ReportServiceStatus
(
win32service
.
SERVICE_STOP_PENDING
)
win32event
.
SetEvent
(
self
.
hWaitStop
)
reactor
.
stop
()
logger
.
info
(
"
%
s stopped"
,
__file__
)
def
SvcDoRun
(
self
):
servicemanager
.
LogMsg
(
servicemanager
.
EVENTLOG_INFORMATION_TYPE
,
servicemanager
.
PYS_SERVICE_STARTED
,
(
self
.
_svc_name_
,
''
))
logger
.
info
(
"
%
s starting"
,
__file__
)
agent_main
()
...
...
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