我看到 Laravel 使用 Monolog 库来处理日志。我在工作中有以下处理方法:
ApiUpdateItemJob.php:
public function handle()
{
$data = [
'id' => $this->item_id,
'data[status]' => $this->status,
];
$response = ApiFacedeClient::exec('Item', 'update', $data);
$result = json_decode($response->getBody());
}
Run Code Online (Sandbox Code Playgroud)
在工人的日志(主管)中,我看到以下内容:
public function handle()
{
$data = [
'id' => $this->item_id,
'data[status]' => $this->status,
];
$response = ApiFacedeClient::exec('Item', 'update', $data);
$result = json_decode($response->getBody());
}
Run Code Online (Sandbox Code Playgroud)
我应该在作业中添加什么才能看到以下行:
[2019-12-17 05:11:54][40792762] 处理项目 ID #333333(状态 [200 OK]):App\Jobs\UpdateItemStatus
当我安装Spree网站时(根据本指南:http://guides.spreecommerce.com/getting_started.html),我遇到了这个问题:
deploy @ bothunter:〜/ rails $ sudo -i gem install rails
成功安装rails-3.2.1
1 gem安装
deploy @ bothunter:〜/ rails $ sudo -i gem install bundler成功安装了bundler-1.0.22 1 gem安装了
deploy @ bothunter:〜/ rails $ sudo -i gem install spree
成功安装了spree-1.0.0 1 gem安装了
deploy @ bothunter:〜/ rails $ rails new mystore -d mysql create
create README.rdoc
创建Rakefile
创建配置
.....运行bundle install
获取https://rubygems.org/的源索引
使用rake(0.9.2.2)
使用activemodel(3.2.1)
.....使用rack-test(0.6.1)
使用hike(1.2.1)
使用actionpack(3.2.1).....使用coffee-rails(3.2.2)
使用jquery-rails(2.0.0)
使用mysql2(0.3.11)
使用rails(3.2.1)
使用uglifier(1.2.3) )
你的包完整了!用bundle show [gemname]看到的是安装了捆绑的宝石在哪里. …
我正在使用 django 模板来渲染我的网页。在展开递归树的过程中,发生了一些奇怪的事情(并且无空格标签没有帮助)。
\n\n这是我的递归模板:
\n\n索引.html:
\n\n<ul class="Container">\n <li class="IsRoot">\n <div class="Expand">\n\n </div>\n\n <div class="Content">\n \xd0\xa1\xd0\xbe\xd0\xb4\xd0\xb5\xd1\x80\xd0\xb6\xd0\xb0\xd0\xbd\xd0\xb8\xd0\xb5\n </div>\n\n\n\n </li>\n\n {% include \'list.html\' with data=list %}\n\n</ul>\nRun Code Online (Sandbox Code Playgroud)\n\n和 list.html (作为递归部分):
\n\n<ul class="Container">\n <li class="Node ExpandClosed">\n <div class="Expand"></div>\n <div class="Content">\n <a href="/help/{{data.name}}">\n {{data.content}}\n </a>\n </div>\n {% for item in data.decendent %}\n {% include \'list.html\' with data=item %}\n {% endfor %}\n </li>\n</ul>\nRun Code Online (Sandbox Code Playgroud)\n\n结果如下:
\n\n
使用 open("index.html", \'r\').read() 作为 html 文件内容读取的文件的 html 内容被提取为文本,而不是 html:
\n\n<div id="frame" style="float:left; margin-left:310px;">\n <!DOCTYPE …Run Code Online (Sandbox Code Playgroud) 是否有更短的方法可以将此 ISO 8601 兼容 UTC 时间转换为 SQL DATETIME 格式?
>>> str = "2016-03-28T20:23:46+0800"
>>> temp = str.split('T')
>>> temp[1] = temp[1].rstrip('+')
>>> temp[1]
'20:23:46+0800'
>>> temp[1] = temp[1].split('+')[0]
>>> result = " ".join(temp)
>>> result
'2016-03-28 20:23:46'
Run Code Online (Sandbox Code Playgroud)
谢谢!
如何一个接一个地依次运行 20 - 30 个脚本,并在执行最后一个脚本后 - 再次运行第一个并每小时运行一次迭代?
我尝试使用 crontab 来实现它,但这是一种笨重的方法。我想保证每一刻只有一个脚本在运行。每个脚本的执行时间约为 1 分钟。
我为这样的目标编写了一个 bash 脚本,并认为使用 cron 每小时运行一次:
if ps ax | grep $0 | grep -v $$ | grep bash | grep -v grep
then
echo "The script is already running."
exit 1
else
python script1.py
python script2.py
python script3.py
...
python script30.py
fi
Run Code Online (Sandbox Code Playgroud)
但这是一个好方法吗?