看起来java开发人员正在避免使用log4j.yaml进行日志记录,而是希望使用log4j.xml
我知道在log4j v2中有这方面的支持,但不明白为什么在互联网上没有与此相关的详细文档?
我找到了很多文档python/ruby logging和yaml.我知道java是旧语言,但不明白为什么java开发人员对新事物不感兴趣.
更新:
发现怎么办,很难;)
log4j2.yml或log4j2-test.yml
# why yaml http://jessenoller.com/blog/2009/04/13/yaml-aint-markup-language-completely-different
status: WARN
monitorInterval: 900 # 15 min = 900 sec
properties:
property:
-
name: pattern_layout_console
value: "%d - [%t] %-5p - %c - %M(%L) | %m%n"
-
name: pattern_layout_console_no_threads
value: "%d - %-5p - %c - %M(%L) | %m%n"
-
name: log_path
value: "./logs"
appenders:
console:
-
name: CONSOLE
PatternLayout:
pattern: "${pattern_layout_console_no_threads}"
file:
-
name: DEBUG_FILE
fileName: ${log_path}/debug.log
PatternLayout:
pattern: "${pattern_layout_console}"
append: false
-
name: INFO_FILE
fileName: ${log_path}/info.log …Run Code Online (Sandbox Code Playgroud) 我想使用“utf-8”字符串常量,因为在“UTF-8”、“UTF8”、“utf8”、“utf-8”、“utf-8”、“utf_8”之间进行选择总是让我感到困惑”
python 文档中的所有代码示例的语法如下:
with io.open("/tmp/a.txt", "w", encode="utf-8") as file_cursor:
file_cursor.write(text)
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我为什么会这样,也许是一些最佳实践,zends ...?
我想在 IDE 中使用代码建议来实现以下目标:
with io.open("/tmp/a.txt", "w", encode=ENCODINGS.UTF8) as file_cursor:
file_cursor.write(text)
Run Code Online (Sandbox Code Playgroud)
python核心中是否有任何开箱即用的标准常量?
假设我有一个文件 test_scratch_2.py
import pytest
def my_fun(number: int):
if number == 1:
raise ValueError("Some Message for number 1")
if number == 2:
raise ValueError("Some Message for number 2")
if number == 3:
return int("number")
return number ** 2
@pytest.mark.parametrize("digit", [
# example 1
pytest.param(1, id="first",
marks=pytest.mark.xfail(raises=ValueError,
strict=True,
reason="Some Message for number 1")),
# example 2
pytest.param(2, id="second",
marks=pytest.mark.xfail(raises=ValueError,
strict=True,
reason="Some Message for number 1")),
pytest.param(3, id="third",
marks=pytest.mark.xfail(raises=ValueError,
strict=True,
reason="Some Message for number xxxxxxxxx")),
4,
5,
60000
])
def test_my_fun(digit):
assert my_fun(digit) …Run Code Online (Sandbox Code Playgroud) make install仅当requirements.txt发生更改时,如何才能运行目标?
我不想每次升级包时都升级make install
我通过创建假文件找到了一些解决方法,_requirements.txt.pyc但又丑又脏。它将拒绝第二次安装piprequirements,因为requirements.txt没有变化
$ make install-pip-requirements \nmake: Nothing to be done for 'install-pip-requirements'.\nRun Code Online (Sandbox Code Playgroud)\n\n但我的目标是:
\n\n# first time,\n$ make install # create virtual environment, install requirements\n\n# second time\n$ make install # detected and skipping creating virtual env,\n # detect that requirements.txt have no changes \n # and skipping installing again all python packages\nmake: Nothing to be done for 'install'.\nRun Code Online (Sandbox Code Playgroud)\n\nPython 包看起来像:
\n\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Makefile\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 README.rst\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 lambda_handler.py\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 …Run Code Online (Sandbox Code Playgroud)