CN112286894A - Log generation method and device and readable storage medium - Google Patents
Log generation method and device and readable storage medium Download PDFInfo
- Publication number
- CN112286894A CN112286894A CN202011179624.6A CN202011179624A CN112286894A CN 112286894 A CN112286894 A CN 112286894A CN 202011179624 A CN202011179624 A CN 202011179624A CN 112286894 A CN112286894 A CN 112286894A
- Authority
- CN
- China
- Prior art keywords
- log
- log file
- command
- state
- updating
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 24
- 230000009471 action Effects 0.000 claims abstract description 8
- 230000008859 change Effects 0.000 claims description 12
- 230000004048 modification Effects 0.000 claims description 7
- 238000012986 modification Methods 0.000 claims description 7
- 238000012216 screening Methods 0.000 claims description 6
- 238000012423 maintenance Methods 0.000 abstract description 4
- 230000006870 function Effects 0.000 description 10
- 238000005192 partition Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 239000003607 modifier Substances 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/1805—Append-only file systems, e.g. using logs or journals to store data
- G06F16/1815—Journaling file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/1873—Versioning file systems, temporal file systems, e.g. file system supporting different historic versions of files
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Debugging And Monitoring (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a log generation method, a device and a readable storage medium, wherein the log generation method comprises the following steps: detecting a version updating action, and automatically calling a log updating command of a log file; responding to the log updating command, and updating the content of the log file by a preset specification; and changing the updated log file from the first state to the second state to wait for submission. According to the invention, the log file is automatically generated, the labor cost for maintaining the log file is eliminated, and the format of the log file is unified and standardized, so that the reading cost is reduced, and the maintenance is simple.
Description
Technical Field
The present invention relates to the field of terminals, and in particular, to a log generation method and apparatus, and a readable storage medium.
Background
The log file is one of important data in system operation and maintenance. The log file of each item records version iteration information and function update information of the item, and thus the log file plays an important role in each item.
However, the log file is generally maintained manually, and developers manually write information such as function change, code change link, modifiers and the like into the log file, which is time-consuming; or the log file is automatically generated after the command is manually executed, and the command needs to be manually executed once every time the version is updated, which is complicated.
Disclosure of Invention
The invention provides a log generation method, a log generation device and a readable storage medium, which are used for solving the problems of high labor cost and non-uniform format of log files in updating the log files.
According to a first aspect of the present invention, there is provided a log generating method, comprising: detecting a version updating action, and automatically calling a log updating command of a log file; responding to the log updating command, and updating the content of the log file by a preset specification; and changing the updated log file from a first state to a second state to wait for submission, wherein the first state is an updated state, and the second state is a state before submission.
In some embodiments, the step of automatically invoking the log update command of the log file includes: acquiring a calling command; and responding to the calling command, calling the log updating command of the log file.
In some embodiments, the step of updating the log file to be a to-be-submitted log file includes: reading a generation rule of the log file, wherein the generation rule comprises at least one of the following items: determining the name of the log file and screening the submission information.
In some embodiments, the step of updating the log file to be a to-be-submitted log file includes: reading a generation template of the log file, wherein the information of the generation template comprises at least one of the following items: code submission information, code modification links, and author information.
In some embodiments, the step of changing the updated log file from the first state to the second state to wait for the commit comprises: acquiring a storage command; and responding to the storage command, and storing the updated log file to a temporary storage area.
According to a second aspect of the present invention, the present invention provides a log generating apparatus, including a calling module, configured to detect a version change action, and automatically call a log update command of a log file; the updating module is used for responding to the log updating command and updating the content of the log file by a preset specification; and the state changing module is used for changing the updated log file from a first state to a second state to wait for submission, wherein the first state is an updated state, and the second state is a state before submission.
In some embodiments, the calling module comprises: the first acquisition unit is used for acquiring a calling command; and the calling unit is used for responding to the calling command and calling the log updating command of the log file.
In some embodiments, the update module comprises: a first reading unit, configured to read a generation rule of the log file, where the generation rule includes at least one of: determining the name of the log file and screening the submission information.
In some embodiments, the update module comprises: a second reading unit, configured to read a generation template of the log file, where information of the generation template includes at least one of: code submission information, code modification links, and author information.
In some embodiments, the state change module comprises: a second obtaining unit, configured to obtain a storage command; and the storage unit is used for responding to the storage command and storing the updated log file to the temporary storage area.
According to a third aspect of the present invention, there is provided a readable storage medium on which a program or instructions are stored, which program or instructions, when executed by a processor, implement the log generation method as described above.
Compared with the prior art, the invention has the beneficial effects that: according to the invention, the log file is automatically generated, the labor cost for maintaining the log file is eliminated, and the format of the log file is unified and standardized, so that the reading cost is reduced, and the maintenance is simple.
Drawings
Fig. 1 is a schematic flowchart illustrating steps of a log generating method according to an embodiment of the present invention.
Fig. 2 is a schematic structural diagram of a log generating apparatus according to an embodiment of the present invention.
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a log generation method, which includes steps S11 to S13.
Two commands, "update" and "changelog" are preset:
1、“update”:“yarn changelog&&git add CHANGELOG_AUTO.md”。
2、“changelog”:“auto-changelog-p”。
step S11, when a version change action is detected, a log update command of the log file is automatically invoked.
In the embodiment of the invention, when the version of a certain item is detected to be changed, namely the 'git commit' command is executed, the command is prevented from being manually executed each time the item is updated, and the log update command of the log file is automatically called to generate the latest log file. The step of automatically calling the log update command of the log file specifically comprises the following steps: acquiring a calling command; and responding to the calling command, calling the log updating command of the log file.
In some embodiments, the hook function is triggered when the execution of the code commit command is started, and in the embodiment of the present invention, the hook function is a pre-commit hook, and the hook function is used to interrupt the code commit, and execute a call command "yann update" preset in the hook, and the call command is used to call a log update command "update".
Step S12, in response to the log update command, updating the content of the log file with a preset specification.
In the embodiment of the present invention, the "grow changelog" in the log update command "update" executes the "changelog" command to update the log file contents.
In the embodiment of the present invention, the step of updating the content of the log file with a preset specification specifically includes: reading a generation rule of the log file; and/or reading a generation template of the log file. Wherein the generation rule comprises at least one of: determining the name of the log file and screening the submission information. The information of the generated template comprises at least one of the following: code submission information, code modification links, and author information.
The embodiment of the invention pre-configures the generation rule and the generation template, and arranges and updates the log file according to the uniform specification by reading the generation rule and the generation template, so as to keep the content of the log file uniform, thereby reducing the reading cost.
Step S13, changing the updated log file from a first state to a second state to wait for commit, where the first state is an updated state, and the second state is a state before commit.
In an embodiment of the present invention, in the step of changing the updated log file from the first state to the second state to wait for the commit, the method includes: acquiring a storage command; and responding to the storage command, and storing the updated log file to a temporary storage area.
In some embodiments, the updated log file in step S12 is stored to the staging area by executing "git add changed _ auto.md" in "update".
As shown in fig. 2, an embodiment of the present invention provides a log generating apparatus, which includes a calling module 201, an updating module 202, and a state changing module 203.
Two commands, "update" and "changelog" are preset:
1、“update”:“yarn changelog&&git add CHANGELOG_AUTO.md”。
2、“changelog”:“auto-changelog-p”。
the calling module 201 is configured to detect a version change action and automatically call a log update command of the log file.
In the embodiment of the invention, when the version of a certain item is detected to be changed, namely the 'git commit' command is executed, the command is prevented from being manually executed each time the item is updated, and the log update command of the log file is automatically called to generate the latest log file. The calling module 201 includes: the first acquisition unit is used for acquiring a calling command; and the calling unit is used for responding to the calling command and calling the log updating command of the log file.
In some embodiments, the hook function is triggered when the execution of the code commit command is started, and in the embodiment of the present invention, the hook function is a pre-commit hook, and the hook function is used to interrupt the code commit, and execute a call command "yann update" preset in the hook, and the call command is used to call a log update command "update".
The update module 202 is configured to update the content of the log file with a preset specification in response to the log update command.
In the embodiment of the present invention, the "grow changelog" in the log update command "update" executes the "changelog" command to update the contents of the log file.
In the embodiment of the present invention, the update module 202 includes: the first reading unit is used for reading the generation rule of the log file; and/or a second reading unit for reading the generation template of the log file. Wherein the generation rule comprises at least one of: determining the name of the log file and screening the submission information. The information of the generated template comprises at least one of the following: code submission information, code modification links, and author information.
Specifically, the "yann change log" command is executed, that is, the content of the log file is updated according to the generation rule and the generation template by a preset specification, and then the "git add change _ auto.md" is executed to change the updated log file from the first state to the second state to wait for submission, that is, the log file is stored in the temporary storage area.
The embodiment of the invention pre-configures the generation rule and the generation template, and arranges and updates the log file according to the uniform specification by reading the generation rule and the generation template, so as to keep the content of the log file uniform, thereby reducing the reading cost.
The state changing module 203 is configured to change the updated log file from a first state to a second state to wait for commit, where the first state is an updated state, and the second state is a state before commit.
In an embodiment of the invention, the state change module 203 comprises: a second obtaining unit, configured to obtain a storage command; and the storage unit is used for responding to the storage command and storing the updated log file to the temporary storage area.
Referring to fig. 3, an embodiment of the invention further provides an electronic device 300, where the electronic device 300 may be a mobile phone, a tablet, a computer, or the like. As shown in fig. 3, the electronic device 300 includes a processor 301, a memory 302. The processor 301 is electrically connected to the memory 302.
The processor 301 is a control center of the electronic device 300, connects various parts of the whole electronic device by using various interfaces and lines, executes various functions of the electronic device and processes data by running or loading an application program stored in the memory 302 and calling the data stored in the memory 302, thereby performing overall monitoring of the electronic device.
In this embodiment, the electronic device 300 is provided with a plurality of memory partitions, where the plurality of memory partitions includes a system partition and a target partition, and the processor 301 in the electronic device 300 loads instructions corresponding to processes of one or more application programs into the memory 302 according to the following steps, and the processor 301 runs the application programs stored in the memory 302, so as to implement various functions:
detecting a version updating action, and automatically calling a log updating command of a log file;
responding to the log updating command, and updating the content of the log file by a preset specification; and
and changing the updated log file from a first state to a second state to wait for submission, wherein the first state is an updated state, and the second state is a state before submission.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by instructions controlling associated hardware, and the instructions may be stored in a computer readable storage medium and loaded and executed by a processor. To this end, the present invention provides a readable storage medium, in which a plurality of instructions are stored, where the instructions can be loaded by a processor to execute the steps in any one of the log generation methods provided by the embodiments of the present invention.
Wherein the readable storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the readable storage medium can execute the steps in any log generation method provided in the embodiment of the present invention, beneficial effects that can be achieved by any log generation method provided in the embodiment of the present invention can be achieved, which are detailed in the foregoing embodiments and will not be described herein again. The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
The invention has the beneficial effects that: according to the invention, the log file is automatically generated, the labor cost for maintaining the log file is eliminated, and the format of the log file is unified and standardized, so that the reading cost is reduced, and the maintenance is simple.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The log generation method, the log generation system, the readable storage medium and the electronic device provided by the embodiments of the present invention are described in detail above, and a specific example is applied in the text to explain the principle and the implementation of the present invention, and the description of the above embodiments is only used to help understanding the technical scheme and the core idea of the present invention; those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (11)
1. A method of log generation, comprising:
detecting a version updating action, and automatically calling a log updating command of a log file;
responding to the log updating command, and updating the content of the log file by a preset specification; and
and changing the updated log file from a first state to a second state to wait for submission, wherein the first state is an updated state, and the second state is a state before submission.
2. The log generating method as claimed in claim 1, wherein the step of automatically invoking the log update command of the log file comprises:
acquiring a calling command; and
and responding to the calling command, and calling the log updating command of the log file.
3. The log generating method as claimed in claim 1, wherein the step of updating the contents of the log file with a predetermined specification comprises:
reading a generation rule of the log file, wherein the generation rule comprises at least one of the following items: determining the name of the log file and screening the submission information.
4. A log generating method as claimed in claim 1 or 3, wherein in the step of updating said log file to a log file to be submitted, comprises:
reading a generation template of the log file, wherein the information of the generation template comprises at least one of the following items: code submission information, code modification links, and author information.
5. The log generating method as claimed in claim 1, wherein in the step of changing the updated log file from a first state to a second state to wait for a commit, comprising:
acquiring a storage command; and
and responding to the storage command, and storing the updated log file to a temporary storage area.
6. A log generating apparatus, comprising
The calling module is used for detecting the version changing action and automatically calling a log updating command of the log file;
the updating module is used for responding to the log updating command and updating the content of the log file by a preset specification; and the state changing module is used for changing the updated log file from a first state to a second state to wait for submission, wherein the first state is an updated state, and the second state is a state before submission.
7. The log-generation apparatus of claim 6, wherein the invocation module comprises:
the first acquisition unit is used for acquiring a calling command; and
and the calling unit is used for responding to the calling command and calling the log updating command of the log file.
8. The log-generation apparatus of claim 6, wherein the update module comprises:
a first reading unit, configured to read a generation rule of the log file, where the generation rule includes at least one of: determining the name of the log file and screening the submission information.
9. The log-generating apparatus of claim 6 or 8, wherein the update module comprises:
a second reading unit, configured to read a generation template of the log file, where information of the generation template includes at least one of: code submission information, code modification links, and author information.
10. The log-generation apparatus of claim 6, wherein the state change module comprises:
a second obtaining unit, configured to obtain a storage command; and
and the storage unit is used for responding to the storage command and storing the updated log file to the temporary storage area.
11. A readable storage medium, on which a program or instructions are stored, which when executed by a processor, implements the log generation method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011179624.6A CN112286894A (en) | 2020-10-29 | 2020-10-29 | Log generation method and device and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011179624.6A CN112286894A (en) | 2020-10-29 | 2020-10-29 | Log generation method and device and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112286894A true CN112286894A (en) | 2021-01-29 |
Family
ID=74373912
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011179624.6A Pending CN112286894A (en) | 2020-10-29 | 2020-10-29 | Log generation method and device and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112286894A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113419773A (en) * | 2021-05-21 | 2021-09-21 | 北京达佳互联信息技术有限公司 | Log file generation method and device, electronic equipment, storage medium and product |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104537037A (en) * | 2014-12-23 | 2015-04-22 | 杭州华为数字技术有限公司 | Method and device for processing database logs |
CN109857921A (en) * | 2019-01-11 | 2019-06-07 | 平安科技(深圳)有限公司 | A kind of document management method and document file management system updated based on data |
CN110661631A (en) * | 2018-06-28 | 2020-01-07 | 中兴通讯股份有限公司 | Method, device and computer readable storage medium for collecting network element logs |
-
2020
- 2020-10-29 CN CN202011179624.6A patent/CN112286894A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104537037A (en) * | 2014-12-23 | 2015-04-22 | 杭州华为数字技术有限公司 | Method and device for processing database logs |
CN110661631A (en) * | 2018-06-28 | 2020-01-07 | 中兴通讯股份有限公司 | Method, device and computer readable storage medium for collecting network element logs |
CN109857921A (en) * | 2019-01-11 | 2019-06-07 | 平安科技(深圳)有限公司 | A kind of document management method and document file management system updated based on data |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113419773A (en) * | 2021-05-21 | 2021-09-21 | 北京达佳互联信息技术有限公司 | Log file generation method and device, electronic equipment, storage medium and product |
CN113419773B (en) * | 2021-05-21 | 2023-11-28 | 北京达佳互联信息技术有限公司 | Log file generation method and device, electronic equipment, storage medium and product |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111752581B (en) | Upgrading method and device of distributed system and computer system | |
CN110569250B (en) | Management method and device for analysis library of Internet of things network element | |
CN103999036A (en) | Method and system using exceptions for code specialization in a computer architecture that supports transactions | |
CN112765023A (en) | Test case generation method and device | |
CN112668008B (en) | Method for realizing dynamic system call hijacking based on LSM | |
CN111147291B (en) | Service maintenance method and device | |
CN116049207A (en) | Application SQL script processing method and device, processor and electronic equipment | |
CN112286894A (en) | Log generation method and device and readable storage medium | |
CN108334333B (en) | Method and device for updating source code base | |
CN117707543A (en) | Application installation package manufacturing and installation method, computing device and storage medium | |
CN110968339B (en) | Method and device for front-end building tool and electronic equipment | |
CN117234582A (en) | Project code processing method and device, electronic equipment and storage medium | |
CN106293790A (en) | Application program updating method and apparatus based on Firefox operating system | |
CN111427588A (en) | Suspending installation of firmware packages | |
CN115934272A (en) | Online batch task processing method and device | |
CN115309421A (en) | Static variable synchronization method, device, equipment and storage medium of single-point system | |
CN114510334A (en) | Class instance calling method and device, electronic equipment and automatic driving vehicle | |
CN112667463A (en) | Application system baseline state monitoring method and device | |
CN115421785B (en) | Method, device and medium for transplanting application program | |
CN117472458B (en) | System function optimal configuration method and device, electronic equipment and storage medium | |
CN112162833B (en) | Transaction log processing method, device and system | |
CN115858012B (en) | Program variable configuration method, device, electronic equipment and storage medium | |
CN114356604A (en) | Contract calling method and device, electronic equipment and storage medium | |
US20240036861A1 (en) | Automatic generation of interfaces for optimizing codebases | |
CN116302710A (en) | Application version rollback method, device, computer equipment and storage medium |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210129 |
|
RJ01 | Rejection of invention patent application after publication |