Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
4d1ef9bb
G
glances
项目概览
蜕变的菜鸟
/
glances
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
glances
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4d1ef9bb
编写于
1月 06, 2015
作者:
N
Nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
R/W error with the glances.log file (issue #474)
上级
0bd5993a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
1 deletion
+22
-1
NEWS
NEWS
+6
-0
docs/glances-doc.rst
docs/glances-doc.rst
+2
-0
glances/core/glances_logging.py
glances/core/glances_logging.py
+14
-1
未找到文件。
NEWS
浏览文件 @
4d1ef9bb
...
...
@@ -5,6 +5,8 @@ Glances Version 2.x
Version 2.3
===========
Enhancements and news features:
* Add actions on alerts (issue #132). It is now possible to run action (command line) by triggers. Action could containq {Mustache} {{tag}} (Mustache) with stat value.
* Add InfluxDB export module (--export-influxdb) (issue #455)
* Add Statsd export module (--export-statsd) (issue #465)
...
...
@@ -13,6 +15,10 @@ Version 2.3
* Add the RAID plugin (issue #447)
* Add the Docker plugin (issue #440)
Bugs corrected:
* R/W error with the glances.log file (issue #474)
Version 2.2.1
=============
...
...
docs/glances-doc.rst
浏览文件 @
4d1ef9bb
...
...
@@ -332,6 +332,8 @@ By default, the log file is under:
:Linux, \*BSD and OS X: ``/tmp/glances.log``
:Windows: ``%APPDATA%\Local\temp\glances.log``
If glances.log is not writable, a new file will be created and returned to the user console.
Anatomy Of The Application
==========================
...
...
glances/core/glances_logging.py
浏览文件 @
4d1ef9bb
...
...
@@ -71,14 +71,27 @@ LOGGING_CFG = {
}
def
tempfile_name
():
"""Return the tempfile name (full path)"""
ret
=
os
.
path
.
join
(
tempfile
.
gettempdir
(),
'glances.log'
)
if
os
.
access
(
ret
,
os
.
F_OK
)
and
not
os
.
access
(
ret
,
os
.
W_OK
):
print
(
"Warning: can't write logs to file {} (permission denied)"
.
format
(
ret
))
ret
=
tempfile
.
mkstemp
(
prefix
=
'glances'
,
suffix
=
'.tmp'
,
text
=
True
)
print
(
"Create a new log file: {}"
.
format
(
ret
[
1
]))
return
ret
[
1
]
def
glances_logger
():
"""Build and return the logger"""
temp_path
=
tempfile_name
()
_logger
=
logging
.
getLogger
()
try
:
LOGGING_CFG
[
'handlers'
][
'file'
][
'filename'
]
=
temp_path
logging
.
config
.
dictConfig
(
LOGGING_CFG
)
except
AttributeError
:
# dictConfig is only available for Python 2.7 or higher
# Minimal configuration for Python 2.6
logging
.
basicConfig
(
filename
=
os
.
path
.
join
(
tempfile
.
gettempdir
(),
'glances.log'
)
,
logging
.
basicConfig
(
filename
=
temp_path
,
level
=
logging
.
DEBUG
,
format
=
'%(asctime)s -- %(levelname)s -- %(message)s'
)
return
_logger
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录