有没有办法记录由 rpm 完成的活动? [英] Is there a way to log activities done by a rpm?

查看:46
本文介绍了有没有办法记录由 rpm 完成的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试记录由我的 rpm 完成的活动,但无法找到一种方法来做到这一点.我正在寻找某种方法来通过规范文件本身来做到这一点.如果我的 rpm 执行了 5 个步骤,我需要一种方法将这些步骤及其结果记录到日志中.

I am trying to log the activities done by my rpm, but unable to find a way to do it. I am looking for some way to do it through the spec file itself. If there are 5 steps my rpm performs, I need a way to log these steps and their results to a log.

我在谷歌搜索后找到了这个 - http://www.rpm.org/wiki/转速日志.似乎这项工作仍在进行中(?).

I found this after a brief google search - http://www.rpm.org/wiki/RpmLog . It seems like this work is still underway(?).

我能够按照这个创建一个目录来保存日志,但是我如何在这个专门创建的目录中实际向日志文件写入一些内容?我应该在规范文件中添加一些语句?

I was able to create a directory to save the logs following this, but how do I actually write something to a log file in this specially created directory? Some statements I should add to the spec file?

推荐答案

我能够通过对我之前提到的链接的一个小扩展来记录我的 rpm 的活动 - 安装rpm时创建日志文件.创建此文件后,我开始将日志消息回显到我在规范文件中创建的文件中.

I was able to log the activities of my rpm by a little extension to a link I had mentioned earlier - Create log file when installing rpm. After creating this file, I started echo-ing my log messages to the file I created in the spec file.

echo "这是一条日志消息" >>$RPM_BUILD_ROOT/var/log/mylogfile.txt

所以,在我想记录 rpm 完成的重要活动的任何地方,我都添加了这样的语句.我还观察到,当我卸载 rpm 时,这个文件被删除了.

So, wherever I wanted to note an important activity done by the rpm, I was adding such statements. I also observed that this file got removed when I uninstalled the rpm.

这篇关于有没有办法记录由 rpm 完成的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆