CN112231176A - Simple and convenient log recording method for VxWorks operating system - Google Patents

Simple and convenient log recording method for VxWorks operating system Download PDF

Info

Publication number
CN112231176A
CN112231176A CN202011099179.2A CN202011099179A CN112231176A CN 112231176 A CN112231176 A CN 112231176A CN 202011099179 A CN202011099179 A CN 202011099179A CN 112231176 A CN112231176 A CN 112231176A
Authority
CN
China
Prior art keywords
vxworks
log
function
operating system
loglib
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011099179.2A
Other languages
Chinese (zh)
Other versions
CN112231176B (en
Inventor
赵继伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Jinhang Computing Technology Research Institute
Original Assignee
Tianjin Jinhang Computing Technology Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Jinhang Computing Technology Research Institute filed Critical Tianjin Jinhang Computing Technology Research Institute
Priority to CN202011099179.2A priority Critical patent/CN112231176B/en
Publication of CN112231176A publication Critical patent/CN112231176A/en
Application granted granted Critical
Publication of CN112231176B publication Critical patent/CN112231176B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data

Abstract

The invention relates to a simple log recording method for a VxWorks operating system, and belongs to the field of embedded software development. Adding a system log library source file logLib.c attached to a VxWorks operating system development environment into a VxWorks Image project; modifying logLib.c in VxWorks Image engineering, and adding a mounting point of a custom log processing function in the logLib.c; developing a related system log recording program based on a function format of a user-defined mounting point, and integrating the system log recording program into VxWorks Image engineering; and modifying the compiling sequence of each source file in the VxWorks Image project, moving logLib.o to the top, compiling and running the VxWorks Image project. The log recording method of the VxWorks operating system can simply and conveniently control the write-in frequency, error processing, overtime time and other related configurations of the log, easily realize the self-defined log recording function, and has the advantages of simple configuration, low cost, high safety and convenient use.

Description

Simple and convenient log recording method for VxWorks operating system
Technical Field
The invention belongs to the field of embedded software development, and particularly relates to a simple and convenient log recording method for a VxWorks operating system.
Background
The system log is important data for recording and analyzing the operation process of the operating system. The VxWorks operating system is used as a common operating system in the embedded field, provides a self-contained system log library LogLib, and can mount a file descriptor of a standard file IO in the log library to write the system log into a persistent storage medium such as a hard disk, a memory card and the like.
However, the file writing function of the log library provided in the system does not provide configuration attributes regarding writing frequency, error handling and the like, and is inconvenient to use. If a user wishes to customize the file writing method of the system log, there are two conventional methods. The first is self-defining VxWorks Source Bui ld engineering, editing and modifying the related function files of the kernel, and then recompiling the whole kernel file. The method has some problems, firstly, the engineering has more compiling contents, relatively complex configuration and high cost, and the engineering customized by some un-open kernels is difficult to compile completely. Secondly, searching a related function of the LogLib in the running memory, and performing memory coverage by using the modified function. The method has low safety, is very troublesome to process and is inconvenient to use.
Disclosure of Invention
Technical problem to be solved
The invention aims to solve the technical problems that how to provide a simple log recording method for a VxWorks operating system is to solve the problems that the file writing function of a log library of the VxWorks operating system is inconvenient to use, and the file writing method for customizing a system log by a user is complex in configuration, high in cost, low in safety and the like.
(II) technical scheme
In order to solve the technical problem, the invention provides a simple log recording method for a VxWorks operating system, which comprises the following steps:
s1, adding a system log library source file logLib.c attached to the VxWorks operating system development environment into a VxWorks Image project;
s2, modifying logLib.c in VxWorks Image engineering, and adding a mount point of a custom log processing function;
s3, developing a related system log recording program based on the function format of the custom mounting point, and integrating the system log recording program into VxWorks Image engineering;
s4, modifying the compiling sequence of each source file in the VxWorks Image project, moving logLib.o to the forefront, and compiling and running the VxWorks Image project.
Further, the step S2 specifically includes: adding a function pointer with the same parameter as the logMsg function, and determining the function pointer as a global variable; adding judgment null for the function pointer in the lprintf function, and executing if the function pointer is not null; the global function pointer variable is the mount point of the custom log processing function.
Further, the total operation flow after modifying loglib.c in the step S2 is as follows: and taking out a log from the message queue, calling the original log function processing of the system, judging whether the mounting point is mounted, calling a self-defined log processing function if the mounting point is mounted, and ending the log processing if the mounting point is not mounted.
Further, the method for implementing the custom log processing function in step S3 includes: recording the time of the log, and temporarily storing the time and 7 parameters which are originally the same as the logMsg function into another message queue; then a task is operated, the task reads the temporary stored message queue and writes the log information in the message queue into a persistent storage medium; and in the function, relevant configuration is controlled, and a self-defined log recording function is realized.
Further, the relevant configurations include write frequency, error handling, and timeout time.
Further, the step S4 specifically includes: in a VxWorks operating system development environment Workbench, modifying the attribute of a corresponding VxWorks Image project, selecting a Content tab in a Bui ld Properties option page, finding the logLib.o in the Content tab, adjusting the sequence of the logLib.o to the top through an up button on the right side, namely compiling the top, and then compiling the VxWorks Image project and running in a target environment.
(III) advantageous effects
The invention provides a simple and convenient VxWorks operating system log recording method, which can conveniently replace a related processing method of a system log library LogLib in compiling VxWorks Image engineering by utilizing a built-in mechanism of a development environment matched with a VxWorks operating system, and realizes the user-defined recording of system logs. The log recording method of the VxWorks operating system can simply and conveniently control the write-in frequency, error processing, overtime time and other related configurations of the log, easily realize the self-defined log recording function, and has the advantages of simple configuration, low cost, high safety and convenient use.
Drawings
FIG. 1 is a flow chart of the process associated with a mount point of the present invention.
Detailed Description
In order to make the objects, contents and advantages of the present invention clearer, the following detailed description of the embodiments of the present invention will be made in conjunction with the accompanying drawings and examples.
The embodiment of the invention provides a simpler VxWorks operating system log recording method, which can conveniently replace a related processing method of a system log library LogLib in a VxWorks Image project by utilizing a built-in mechanism of a development environment matched with a VxWorks operating system, and can realize custom recording of a system log.
The implementation method for the log record of the VxWorks operating system comprises the following steps:
and adding a system log library source file loglib.c attached to the VxWorks operating system development environment into the VxWorks Image project.
And modifying logLib.c in VxWorks Image engineering, and adding a mounting point of a custom log processing function into the logLib.c.
And developing a related system log recording program based on a function format of a custom mounting point, and integrating the system log recording program into VxWorks Image engineering.
And modifying the compiling sequence of each source file in the VxWorks Image project, moving logLib.o to the top, compiling and running the VxWorks Image project.
In this embodiment, a method for recording a system log will be described step by step, and a final product after the method is a customized VxWorks Image project with a system log custom recording method. The method comprises the following specific steps:
step 1: and adding a system log library source file loglib.c attached to the VxWorks operating system development environment into the VxWorks Image project.
Generally, neither a third-party customized VxWorks operating system library nor a system library carried along with a development environment can adjust the content of loglib.c, and the development environment of the VxWorks operating system carries the source code loglib.c of a system log library, so that the source file is directly imported into a VxWork Image project to be developed.
Step 2: and modifying logLib.c in VxWorks Image engineering, and adding a mounting point of a custom log processing function into the logLib.c.
Modifying loglib.c content, taking out a log from a message queue as shown in the general operation flow shown in figure 1, calling the original log function processing of the system, judging whether a mounting point is mounted, calling a self-defined log processing function if the mounting point is mounted, and ending the log processing if the mounting point is not mounted.
The specific modification method comprises the following steps: adding a function pointer with the same parameter as the logMsg function, and determining the function pointer as a global variable; the lprintf function is executed by adding a null for the function pointer and if not null. The global function pointer variable is the mount point of the custom log processing function.
And step 3: and developing a related system log recording program based on a function format of a custom mounting point, and integrating the system log recording program into VxWorks Image engineering.
The specific implementation method of the mounting point function is not unique, and generally may be: recording the time of the log, and temporarily storing the time and 7 parameters which are originally the same as the logMsg function into another message queue; and then a task is operated, the task reads the temporarily stored message queue, the log information in the message queue is written into the persistent storage medium, and in the function, the write-in frequency, error processing, timeout time and other related configurations are controlled, so that the self-defined log recording function is realized.
And 4, step 4: and modifying the compiling sequence of each source file in the VxWorks Image project, moving logLib.o to the top, compiling and running the VxWorks Image project.
In a VxWorks operating system development environment Workbench, modifying the attribute of a corresponding VxWorks Image project, selecting a Content tab in a Bui ld Properties tab, finding the logLib.o in the Content tab, and adjusting the sequence of the logLib.o to the top through an up button on the right side, namely compiling the top. The VxWorks Image project is then compiled and run in the target environment.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.

Claims (6)

1. A simple log recording method for a VxWorks operating system is characterized by comprising the following steps:
s1, adding a system log library source file logLib.c attached to the VxWorks operating system development environment into a VxWorks Image project;
s2, modifying logLib.c in VxWorks Image engineering, and adding a mount point of a custom log processing function;
s3, developing a related system log recording program based on the function format of the custom mounting point, and integrating the system log recording program into VxWorks Image engineering;
s4, modifying the compiling sequence of each source file in the VxWorks Image project, moving logLib.o to the forefront, and compiling and running the VxWorks Image project.
2. The convenient VxWorks operating system logging method of claim 1, wherein said step S2 specifically comprises: adding a function pointer with the same parameter as the logMsg function, and determining the function pointer as a global variable; adding judgment null for the function pointer in the lprintf function, and executing if the function pointer is not null; the global function pointer variable is the mount point of the custom log processing function.
3. The convenient VxWorks operating system logging method of claim 1, wherein the total running flow after modifying logLib.c in step S2 is as follows: and taking out a log from the message queue, calling the original log function processing of the system, judging whether the mounting point is mounted, calling a self-defined log processing function if the mounting point is mounted, and ending the log processing if the mounting point is not mounted.
4. The convenient VxWorks operating system logging method of any one of claims 1-3, wherein the implementation method of the custom log processing function in step S3 includes: recording the time of the log, and temporarily storing the time and 7 parameters which are originally the same as the logMsg function into another message queue; then a task is operated, the task reads the temporary stored message queue and writes the log information in the message queue into a persistent storage medium; and in the function, relevant configuration is controlled, and a self-defined log recording function is realized.
5. The trivial VxWorks operating system logging method of claim 4, wherein the relevant configurations include write frequency, error handling and timeout time.
6. The convenient VxWorks operating system logging method of claim 1, wherein said step S4 specifically comprises: in a VxWorks operating system development environment Workbench, modifying the attribute of a corresponding VxWorks Image project, selecting a Content tab in a Build Properties option page, finding the logLib.o in the Content tab, adjusting the sequence of the logLib.o to the top through an up button on the right side, namely compiling the top, and then compiling the VxWorks Image project and running in a target environment.
CN202011099179.2A 2020-10-14 2020-10-14 Simple and convenient log recording method for VxWorks operating system Active CN112231176B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011099179.2A CN112231176B (en) 2020-10-14 2020-10-14 Simple and convenient log recording method for VxWorks operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011099179.2A CN112231176B (en) 2020-10-14 2020-10-14 Simple and convenient log recording method for VxWorks operating system

Publications (2)

Publication Number Publication Date
CN112231176A true CN112231176A (en) 2021-01-15
CN112231176B CN112231176B (en) 2023-03-03

Family

ID=74113664

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011099179.2A Active CN112231176B (en) 2020-10-14 2020-10-14 Simple and convenient log recording method for VxWorks operating system

Country Status (1)

Country Link
CN (1) CN112231176B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1490720A (en) * 2002-10-17 2004-04-21 深圳市中兴通讯股份有限公司 Start and update method for VxWorks operation system based dynamic host computer configuration protocol server
US7222131B1 (en) * 2002-09-24 2007-05-22 Rockwell Automation Technologies, Inc. System and methodology facilitating data warehousing of controller images in a distributed industrial controller environment
CN201266388Y (en) * 2008-09-28 2009-07-01 长沙湘计海盾科技有限公司 High integration embedded graphics display drive device
CN101751273A (en) * 2008-12-15 2010-06-23 中国科学院声学研究所 Safety guide device and method for embedded system
US20110131188A1 (en) * 2009-12-01 2011-06-02 International Business Machines Corporation Method and system for real time system log integrity protection
CN102360305A (en) * 2011-10-09 2012-02-22 中国航天科技集团公司第五研究院第五一三研究所 VxWorks operating system scaling and customizing method for aerospace computer
CN102438116A (en) * 2011-08-17 2012-05-02 中国科学院光电技术研究所 Embedded type Linux system-based high-speed image recording device
CN106155881A (en) * 2015-03-26 2016-11-23 中国航天科工集团第四研究院指挥自动化技术研发与应用中心 Applied program testing method and system for VxWorks platform
WO2017173924A1 (en) * 2016-04-06 2017-10-12 中兴通讯股份有限公司 Method and device for switching between file systems
US20170295182A1 (en) * 2016-04-12 2017-10-12 Guardknox Cyber Technologies Ltd. Specially programmed computing systems with associated devices configured to implement secure lockdowns and methods of use thereof
CN107436938A (en) * 2017-07-27 2017-12-05 国家电网公司 A kind of additional daily record analytic method of relational database before image
CN109471776A (en) * 2018-11-13 2019-03-15 天津津航计算技术研究所 A kind of vxworks operating system log collecting method based on Ethernet

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7222131B1 (en) * 2002-09-24 2007-05-22 Rockwell Automation Technologies, Inc. System and methodology facilitating data warehousing of controller images in a distributed industrial controller environment
CN1490720A (en) * 2002-10-17 2004-04-21 深圳市中兴通讯股份有限公司 Start and update method for VxWorks operation system based dynamic host computer configuration protocol server
CN201266388Y (en) * 2008-09-28 2009-07-01 长沙湘计海盾科技有限公司 High integration embedded graphics display drive device
CN101751273A (en) * 2008-12-15 2010-06-23 中国科学院声学研究所 Safety guide device and method for embedded system
US20110131188A1 (en) * 2009-12-01 2011-06-02 International Business Machines Corporation Method and system for real time system log integrity protection
CN102438116A (en) * 2011-08-17 2012-05-02 中国科学院光电技术研究所 Embedded type Linux system-based high-speed image recording device
CN102360305A (en) * 2011-10-09 2012-02-22 中国航天科技集团公司第五研究院第五一三研究所 VxWorks operating system scaling and customizing method for aerospace computer
CN106155881A (en) * 2015-03-26 2016-11-23 中国航天科工集团第四研究院指挥自动化技术研发与应用中心 Applied program testing method and system for VxWorks platform
WO2017173924A1 (en) * 2016-04-06 2017-10-12 中兴通讯股份有限公司 Method and device for switching between file systems
US20170295182A1 (en) * 2016-04-12 2017-10-12 Guardknox Cyber Technologies Ltd. Specially programmed computing systems with associated devices configured to implement secure lockdowns and methods of use thereof
CN107436938A (en) * 2017-07-27 2017-12-05 国家电网公司 A kind of additional daily record analytic method of relational database before image
CN109471776A (en) * 2018-11-13 2019-03-15 天津津航计算技术研究所 A kind of vxworks operating system log collecting method based on Ethernet

Also Published As

Publication number Publication date
CN112231176B (en) 2023-03-03

Similar Documents

Publication Publication Date Title
CN111414377B (en) Method, device and storage medium for processing structured query statement
KR20010033354A (en) Automatic configuration generation
US20100083161A1 (en) Calculator emulation apparatus
US20080313208A1 (en) Apparatus, system, and method for automated context-sensitive message organization
CN102866884A (en) Projecting native application programming interfaces of operating system into other programming languages
EP1635255A2 (en) Information processing system
CN114329366B (en) Network disk file control method and device, network disk and storage medium
CN115543294A (en) Method for generating visual dependency tree of dynamic link library on Linux system
US11030074B2 (en) Code update based on detection of change in runtime code during debugging
CN108334335B (en) Method and device for determining software source code version
CN112231176B (en) Simple and convenient log recording method for VxWorks operating system
CN111475150B (en) Cross-language binding method, device, equipment and storage medium
US20040181777A1 (en) Method and device for programming electronic devices using a uniform parameter format
CN111880822A (en) Dynamic updating method and system based on BIOS Setup interface information
CN112181407B (en) Service realization processing method, device, system, electronic equipment and storage medium
CN114510300A (en) Method and equipment for embedding target object in derived class
CN1248094C (en) Mouse device capable of storing data
CN111930387B (en) Integration method and device of integration package, electronic equipment and storage medium
KR102122968B1 (en) System and method for analyzing of application installation information
US8279735B1 (en) Reproducing system for mediums and method for identifying digital data of the mediums and reproducing the same
CN102254155A (en) Accurate font activation
US7305660B2 (en) Method to generate a formatted trace for an embedded device
TW201123010A (en) Updating method of customized-design software source code.
CN116991427B (en) Application compiling method and device, computing equipment and storage medium
US11127021B1 (en) System and methods for information handling

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant