我有一个日志配置文件,用于记录到控制台和具有不同格式和级别的文件.在我的python脚本中,我可以加载此配置,基本上控制台和文件输出都可以.
我在配置文件中设置文件名,如下所示.
是否可以在python脚本中设置该文件名?
python代码:
# set up logging
logging.config.fileConfig(loginipath)
logger = logging.getLogger('sLogger')
# log something
logger.debug('debug message')
logger.info('info message')
logger.warn('warn message')
logger.error('error message')
logger.critical('critical message')
Run Code Online (Sandbox Code Playgroud)
记录配置文件:
[loggers]
keys=root,sLogger
[handlers]
keys=consoleHandler,fileHandler
[formatters]
keys=fileFormatter,consoleFormatter
[logger_root]
level=DEBUG
handlers=consoleHandler
[logger_sLogger]
level=DEBUG
handlers=consoleHandler,fileHandler
qualname=sLogger
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=WARNING
formatter=consoleFormatter
args=(sys.stdout,)
[handler_fileHandler]
class=FileHandler
level=DEBUG
formatter=fileFormatter
args=('logfile.log',)
[formatter_fileFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=
[formatter_consoleFormatter]
format=%(levelname)s - %(message)s
datefmt=
Run Code Online (Sandbox Code Playgroud) 我有以下代码获取json记录集并在客户端Web Sql存储上的三个不同表中插入一些数据.
如何拦截databaseSync()函数的结束?我想要做的是显示一个警报或更好的ajax微调器gif,以便在同步完成时通知用户.
非常感谢你的帮助,ciao!
function databaseSync() {
// table one
$.getJSON("http://192.168.1.40:8888/iOS/mobilesrv/index.php?ACT=one", function(json) {
$.each(json.results, function(i, res) {
db.transaction(function(tx) {
tx.executeSql("INSERT INTO table1 (A, B, C, D) VALUES (?,?,?,?) ", [res.A, res.B, res.C, res.D], onSuccess, onError);
});
});
});
// table two
$.getJSON("http://192.168.1.40:8888/iOS/mobilesrv/index.php?ACT=two", function(json) {
$.each(json.results, function(i, res) {
db.transaction(function(tx) {
tx.executeSql("INSERT INTO table1 (A, B, C, D) VALUES (?,?,?,?) ", [res.A, res.B, res.C, res.D], onSuccess, onError);
});
});
});
// table three
$.getJSON("http://192.168.1.40:8888/iOS/mobilesrv/index.php?ACT=three", function(json) {
$.each(json.results, function(i, res) {
db.transaction(function(tx) …Run Code Online (Sandbox Code Playgroud) 创建了默认的Sailfish OS Qt Quick Application并使用Deploy构建rpm.当我尝试rpm在手机上安装时,我看到了这个错误:
error: Failed dependencies:
libQt5Qml.so.5(Qt_5) is needed by harbour-xxx
Run Code Online (Sandbox Code Playgroud)
libQt5Qml.so.5是由qt5-qtdeclarative安装在手机上的包提供的,并且存在库/usr/lib/.
我在包装时遗漏了什么rpm或是否需要在手机上设置部署应用程序?
编辑:
.yaml生成rpm的文件内容.(为简洁起见编辑)
PkgConfigBR:
- sailfishapp >= 1.0.2
- Qt5Core
- Qt5Qml
- Qt5Quick
Requires:
- sailfishsilica-qt5 >= 0.10.9
Run Code Online (Sandbox Code Playgroud)
生成的.spec文件(为简洁起见而编辑)
Requires: sailfishsilica-qt5 >= 0.10.9
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: desktop-file-utils
Run Code Online (Sandbox Code Playgroud) 我已经阅读了各种Magento教程以及关于布局的Magento书籍,但我遇到了以下问题.
我创建了一个自定义模块,位于app/code/local/Company/Module /中.我创建了一个位于Company/Module/Block/Ablock.php中的块Company_Module_Block_Ablock.我<config> ... <frontend><layout><updates><module><file>module.xml在Company/Module/etc/config.xml中定义了
config.xml也有
<global>
<blocks>
<module>
<class>Company_Module_Block</class>
</module>
</blocks>
</global>
Run Code Online (Sandbox Code Playgroud)
在这个module.xml里面我有:
<layout>
<company_module_index_index>
<reference name="content">
<block type="module/ablock" name="myablock" template="module/ablock.phtml" />
</reference>
</company_module_index_index>
</layout>
Run Code Online (Sandbox Code Playgroud)
我创建了一个Company/Module/controllers/IndexController.php并在那里定义了一个indexAction
$this->loadLayout();
$this->renderLayout();
Run Code Online (Sandbox Code Playgroud)
但无论我尝试什么,我都无法显示我的ablock.phtml.ablock.phtml位于app/design/frontend/company/default/template/module/ablock.phtml中.该主题已启用,通常在该网站上工作.
我甚至尝试在布局中更改module.xml,因此它甚至不使用模板,甚至不显示任何内容.像这样 -
<reference name="content">
<block type="core/text">
<action method="setText">
<text>Testing</text>
</action>
</block>
</reference>
Run Code Online (Sandbox Code Playgroud)
顺便说一句,自定义主题工作正常,其他页面的内容显示在正确的位置.
我有SetEnv MAGE IS DEVELOPER MODE 1.htaccess,它应该有助于显示警告和事物.但是我的systems.log和exceptions.log中没有错误.(是的日志记录已打开)
任何人都有任何建议如何解决这个问题或发现配置或代码中的错误?
我的下一个选择似乎是破解核心模块代码并记录我的module.xml被加载和解析的位置以查看那里发生了什么.
谢谢.
我正在尝试使用bookmarklet-loader和style-loader和css-loader 创建一个bookmarklet .但我无法将CSS导入我的书签.
这就是我所拥有的
webpack.config.js:
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: {
index: './src/index.js',
bookmarklet: './src/bookmarklets/bookmarklet.js'
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
},
target: 'web',
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.js$/,
use: [
'bookmarklet-loader'
],
include: path.join(__dirname, './src/bookmarklets')
}
]
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
title: 'Development'
})
]
Run Code Online (Sandbox Code Playgroud)
SRC /书签工具/ bookmarklet.js:
import './css/style.css'; …Run Code Online (Sandbox Code Playgroud) 我安装了最新版本的Magento 1.6.0.0-rc2并尝试安装我在Magento 1.5.x上开发的软件包和主题
该软件包已安装在magento/app/design/frontend/packagename中
我还在系统 - >配置 - >设计 - >当前包名称中输入了'packagename'.
在app/design/frontend/packagename/default/layout/page.xml中我指定了默认的'All Pages':
<block type="page/html" name="root" output="toHtml" template="page/2columns-left.phtml">
Run Code Online (Sandbox Code Playgroud)
然而,当我打开模板提示时,我看到正在使用的主模板是base/default/template/page/2columns-right.phtml.
我已经验证了design/frontend/packagename/default/template/page/2columns-left.phtml确实存在.
我一直在尝试一切来调试这个,但我似乎无法弄清楚从哪个配置文件获取2columns-right.phtml.我甚至尝试记录加载的xml文件,但它们没有显示正在加载的主题包中的任何自定义xml文件.
关于可能是什么问题或尝试什么的任何建议?
谢谢.
编辑: 几点.
我想写一个简短的python脚本让我的电脑进入睡眠状态.我已经搜索了API,但暂停的唯一结果与延迟执行有关.诀窍是什么功能?