CN113934695A - POS machine log obtaining method based on java language - Google Patents
POS machine log obtaining method based on java language Download PDFInfo
- Publication number
- CN113934695A CN113934695A CN202111237523.4A CN202111237523A CN113934695A CN 113934695 A CN113934695 A CN 113934695A CN 202111237523 A CN202111237523 A CN 202111237523A CN 113934695 A CN113934695 A CN 113934695A
- Authority
- CN
- China
- Prior art keywords
- log
- pos machine
- pos
- application
- java
- 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 52
- 230000006870 function Effects 0.000 claims abstract description 5
- 238000004806 packaging method and process Methods 0.000 claims abstract description 4
- 238000012856 packing Methods 0.000 claims abstract description 4
- 238000004519 manufacturing process Methods 0.000 abstract description 5
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000012360 testing method 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/17—Details of further file system functions
- G06F16/1734—Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
-
- 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/18—File system types
- G06F16/1805—Append-only file systems, e.g. using logs or journals to store data
- G06F16/1815—Journaling file systems
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)
Abstract
The invention discloses a method for acquiring POS machine logs based on java language, which comprises the following steps: defining and packaging an editing method of a Log Log; compiling a self-defined broadcast receiver, and packing the self-defined broadcast receiver and the self-defined broadcast receiver into Log.jar; developing a tool application with a function of sending custom broadcasting based on Log.jar; adding Log.jar and tool application to the application of the POS machine log to be obtained, and adding the permission of reading the SD card; statically registering a user-defined broadcast receiver on an application of a POS machine Log to be acquired, and calling an editing method of the required Log Log; and using the tool application to send the custom broadcast, receiving the custom broadcast by the application to acquire the POS machine log, and calling a log editing method according to the control parameter information so as to control and generate the POS machine log file. The method can successfully acquire the logs of the intelligent POS machine production system, the adopted tool can conveniently control whether to generate the log file by applying MLog.
Description
Technical Field
The invention relates to the technical field of data processing, in particular to a method for acquiring POS machine logs based on java language.
Background
In the development and test process of intelligent POS software, the Debug system can access an intelligent POS running an application to a personal computer through a local connection manner such as a Universal Serial Bus (USB), and then view and analyze logs by using an adb (android Debug bridge) tool on the personal computer, but after a program is released, there may be problems, such as sudden flash back when the application is doing a transaction, failure to print after the transaction is successful, and the like. But if the log is not used for help, the problem is difficult to locate quickly, the problem is solved in time, and the production is influenced. Problems with applications after release therefore a need exists for a way to intercept logs of applications on intelligent POS (production systems).
Disclosure of Invention
The invention aims to provide a method for acquiring POS machine logs based on java language, so as to solve the problems in the prior art.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
a POS machine log obtaining method based on java language comprises the following steps:
s1, defining an editing method of the Log Log, and packaging the Log Log into 'data tools LogUtils.java';
s2, writing a custom broadcast receiver logbroadcastreeiver.java for calling LogUtils, and packing the logbroadcastreeiver.java and the logutils.java into log.jar;
s3, developing a tool application MLog.apk with a function of sending custom broadcasting based on the Log.jar;
s4, adding Log.jar and tool application to the application of the POS machine log to be obtained, and adding the Log.jar to read the SD card; statically registering a user-defined broadcast receiver on an application of a POS machine Log to be acquired, and then calling an editing method of the required Log Log;
and S5, using a tool application MLog.apk to send a custom broadcast, receiving the custom broadcast by the application of the POS machine log to be obtained, and calling a log editing method in LogUtils.java according to control parameter information in the custom broadcast so as to control and generate a POS machine log file.
Preferably, the method for editing the Log in step S1 includes: the method for writing Log to Sd card, writeLog, the method for setting whether Log file is written to SD card, isWrite, the method setLogPath for setting Log file to be stored to SD card path, and the method deleeLogBefor whether Log is deleted.
Preferably, the information received in the custom broadcast receiver in step S2 includes, but is not limited to, whether to start a method for recording the POS log, whether to delete a previous POS log, and what path the obtained POS log records.
Preferably, the addition of the log.jar permission to read the SD card in step S4 is specifically a permission to read and write the data stored in the POS machine.
Preferably, the tool in step S5 applies the control parameter information in the custom broadcast sent, and the control parameters include, but are not limited to, a parameter of whether to write a file, a parameter of setting a log file saving path, and a parameter of whether to delete a previous POS log.
Preferably, the method for obtaining the POS log based on the java language further includes:
and S6, importing the generated POS machine log file into a storage medium through an OTG line, or uploading the generated log file to a server through a tool application MLog.
The invention has the beneficial effects that:
the invention discloses a method for acquiring POS machine logs based on java language, which can successfully acquire intelligent POS machine production system logs by sending a custom broadcast form to control a log program on a POS machine.
Drawings
FIG. 1 is a flowchart of a method for obtaining POS machine logs based on java language provided in embodiment 1;
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.
Example 1
The embodiment provides a method for acquiring a POS machine log based on java language, as shown in FIG. 1, which includes the following steps:
s1, defining an editing method of a Log, including a method of writing the Log to an Sd card, a method of writing whether a Log file is written to the SD card, a method of setting whether the Log file is written to the SD card, setLogPath, a method of setting whether the Log file is stored to a path of the SD card, and a method of deleting a previous Log, deleLogBefor, and packaging the contents into 'data tools Logutils. java' through function contents provided by a Google platform;
s2, compiling a user-defined broadcast receiver LogBroadcastReceiver.java for calling LogUtils, wherein the user-defined broadcast receiver LogBroadcastReceiver.java comprises a method for recording POS machine logs, a method for deleting previous POS machine logs and a method for recording the paths of the obtained POS logs; packing the LogBroadcastReceiver.java and the LogUtils.java into Log.jar;
s3, developing a tool application MLog.apk with a function of sending custom broadcasting based on the Log.jar;
s4, adding Log.jar and tool application MLog.apk to the application of the POS machine log to be obtained, and adding the Log.jar to read the authority of the SD card in the POS machine; statically registering a user-defined broadcast receiver on an application of a POS machine Log to be acquired, and then calling an editing method of the required Log Log; the method called here can be selected and adjusted according to the actual need;
s5, using a tool application MLog.apk to send a custom broadcast, receiving the custom broadcast by the application of the POS machine log to be obtained, and calling a log editing method in LogUtils.java according to control parameter information in the custom broadcast so as to control and generate a POS machine log file;
the control parameters include, but are not limited to, parameters for writing a file, parameters for setting a log file storage path, and parameters for deleting a previous POS log, and the control parameter information can be set by itself according to application requirements.
And S6, importing the generated POS machine log file into a storage medium through an OTG line, or uploading the generated log file to a server through a tool application MLog.
By adopting the technical scheme disclosed by the invention, the following beneficial effects are obtained:
the invention discloses a method for acquiring POS machine logs based on java language, which can successfully acquire intelligent POS machine production system logs by sending a custom broadcast form to control a log program on a POS machine.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements should also be considered within the scope of the present invention.
Claims (6)
1. A POS machine log obtaining method based on java language is characterized by comprising the following steps:
s1, defining an editing method of the Log Log, and packaging the Log Log into 'data tools LogUtils.java';
s2, writing a custom broadcast receiver logbroadcastreeiver.java for calling LogUtils, and packing the logbroadcastreeiver.java and the logutils.java into log.jar;
s3, developing a tool application MLog.apk with a function of sending custom broadcasting based on the Log.jar;
s4, adding Log.jar and tool application MLog.apk to the application of the POS machine log to be obtained, and adding the Log.jar to read the SD card; statically registering a user-defined broadcast receiver on an application of a POS machine Log to be acquired, and then calling an editing method of the required Log Log;
and S5, using the developed tool application MLog.apk to send a custom broadcast to the application of the POS machine log to be acquired, receiving the custom broadcast by the application of the POS machine log to be acquired, and calling a log editing method in a data tool class Lostuils.java in Log.jar according to the self-set control parameter information in the custom broadcast so as to control and generate the POS machine log file.
2. The method for obtaining POS machine Log based on java language as claimed in claim 1, wherein the editing method of Log Log in step S1 includes but is not limited to: the method for writing Log to Sd card, writeLog, the method for setting whether Log file is written to SD card, isWrite, the method setLogPath for setting Log file to be stored to SD card path, and the method deleeLogBefor whether Log is deleted.
3. The java language based POS log retrieving method of claim 1, wherein the information received in the custom broadcast receiver of step S2 includes but is not limited to whether to start the method for recording POS log, whether to delete previous POS log and what path the retrieved POS log records to.
4. The method for obtaining the POS machine log based on the java language as claimed in claim 1, wherein the log.jar access right to read the SD card in step S4 is specifically a read/write access right stored in the POS machine.
5. The method for obtaining POS machine log based on java language as claimed in claim 1, wherein the tool in step S5 applies control parameter information in custom broadcast sent by MLog.apk, wherein the control parameters include but are not limited to: and whether to write the parameters of the file, and whether to set the parameters of the log file saving path and whether to delete the parameters of the previous POS log.
6. The java language based POS log retrieving method of claim 1, further comprising:
and S6, importing the generated POS machine log file into a storage medium through an OTG line, or uploading the generated log file to a server through a tool application MLog.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111237523.4A CN113934695A (en) | 2021-10-22 | 2021-10-22 | POS machine log obtaining method based on java language |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111237523.4A CN113934695A (en) | 2021-10-22 | 2021-10-22 | POS machine log obtaining method based on java language |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113934695A true CN113934695A (en) | 2022-01-14 |
Family
ID=79283968
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111237523.4A Pending CN113934695A (en) | 2021-10-22 | 2021-10-22 | POS machine log obtaining method based on java language |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113934695A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104169981A (en) * | 2012-03-09 | 2014-11-26 | 日本电气英富醍株式会社 | Pos device |
CN106301884A (en) * | 2015-06-26 | 2017-01-04 | 精工爱普生株式会社 | control device, network system and server |
CN106919494A (en) * | 2015-12-25 | 2017-07-04 | 阿里巴巴集团控股有限公司 | The implementation method and device of Android application daily record |
-
2021
- 2021-10-22 CN CN202111237523.4A patent/CN113934695A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104169981A (en) * | 2012-03-09 | 2014-11-26 | 日本电气英富醍株式会社 | Pos device |
CN106301884A (en) * | 2015-06-26 | 2017-01-04 | 精工爱普生株式会社 | control device, network system and server |
CN106919494A (en) * | 2015-12-25 | 2017-07-04 | 阿里巴巴集团控股有限公司 | The implementation method and device of Android application daily record |
Non-Patent Citations (2)
Title |
---|
王兴梅: "《Android程序设计与应用开发教程》", 31 May 2015, 哈尔滨工业大学出版社, pages: 157 - 158 * |
西西弗斯、: "LogUtils", Retrieved from the Internet <URL:https://blog.csdn.net/iplayvs2008/article/details/50908086> * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110727597B (en) | Method for checking invalid code completion case based on log | |
CN111414231B (en) | Method and equipment for mutual conversion between virtual machine mirror image and container mirror image | |
CN111414362A (en) | Data reading method, device, equipment and storage medium | |
CN107391112A (en) | A kind of FileVersion detection method and its special purpose device | |
CN111367890A (en) | Data migration method and device, computer equipment and readable storage medium | |
CN112650753A (en) | Log management method, device, system, equipment and readable storage medium | |
CN114329366B (en) | Network disk file control method and device, network disk and storage medium | |
US8886597B2 (en) | Synchronizing changes in a file system which are initiated by a storage device and a host device | |
CN112860507A (en) | Method and device for controlling sampling rate of distributed link tracking system | |
CN113934695A (en) | POS machine log obtaining method based on java language | |
CN111737223B (en) | File copying method, device, equipment and storage medium | |
CN111651177B (en) | Number writing method, device and computer readable medium based on android platform | |
CN112732489B (en) | Data desensitization method and device based on database virtualization | |
CN115328851A (en) | Data protection method, device, equipment and medium | |
CN114595096A (en) | Database hot backup method and device, electronic equipment and storage medium | |
CN112069519A (en) | Method and equipment for outputting encrypted record of information file | |
CN115374074A (en) | Log processing method and device, storage medium and electronic equipment | |
CN113504904A (en) | User-defined function implementation method and device, computer equipment and storage medium | |
CN112632211A (en) | Semantic information processing method and equipment for mobile robot | |
CN106897588B (en) | Processing method and device of label function | |
CN111367697A (en) | Error processing method and device | |
CN116881086B (en) | Method and device for monitoring memory during application running, computing equipment and storage medium | |
CN117435385B (en) | Log recording method and device, electronic equipment and storage medium | |
CN117573151A (en) | Method for burning data in flash memory of RISC-V DSP chip, chip | |
JP6888336B2 (en) | Stub generators, methods, and programs |
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 |