A POS machine log acquisition method based on Java language

CN113934695BActive Publication Date: 2024-11-19AITIWEIER ELECTRONICS TECH BEIJING
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111237523.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-22
Publication Date
2024-11-19
Estimated Expiration
2041-10-22

AI Technical Summary

Technical Problem

[0002]在智能POS软件开发和测试过程中,Debug系统可以将运行应用的智能POS通过USB(Universal Serial Bus,通用串行总线)等本地连接方式接入个人电脑后,利用个人电脑上的adb(android debug bridge,安卓调试桥)工具查看和分析这些日志,但是在程序发版之后,仍有可能存在问题,比如应用在做交易的时候突然闪退,交易成功后不能打印等等问题,生产版本的系统是不能使用这种方法截取日志的(原因是POS机存储的是商户终端信息,配置文件等重要信息,这些信息关系到国家金融安全和人民的财产安全所以POS机生产版本的系统是屏蔽掉adb功能的)

Benefits of technology

[0018] The invention discloses a method for obtaining POS machine logs based on Java language. This method controls the log program on the POS machine by sending a customized broadcast, so that the smart POS machine production system log can be successfully obtained. The tool used is MLog. .apk can conveniently control whether to generate log files. Closing log files when they are not needed can save POS machine system resources. The method application is simple and fast.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113934695B_ABST
    Figure CN113934695B_ABST
Patent Text Reader

Abstract

The present invention discloses a POS machine log acquisition method based on java language, comprising the following steps: defining and encapsulating a method for editing a Log log; writing a custom broadcast receiver, and packaging the two into Log.jar; developing a tool application with a function of sending a custom broadcast based on Log.jar; adding Log.jar and a tool application to the application to obtain the POS machine log, and adding the permission to read the SD card; statically registering the custom broadcast receiver on the application to obtain the POS machine log, and calling the required method for editing the Log log; using the tool application to send a custom broadcast, the application to obtain the POS machine log receives the custom broadcast, and calls the log editing method according to the control parameter information, thereby controlling the generation of the POS machine log file. The method can successfully obtain the intelligent POS machine production system log, and the tool application MLog.apk used can conveniently control whether to generate a log file, and closing it when the log file is not needed can save the resources of the POS machine system, and the method application is simple and fast to operate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a POS machine log acquisition method based on Java language. Background Art

[0002] During the development and testing of smart POS software, the debug system can connect the smart POS running the application to a personal computer through a local connection method such as USB (Universal Serial Bus), and use the adb (android debug bridge) tool on the personal computer to view and analyze these logs. However, after the program is released, there may still be problems, such as the application suddenly crashes when doing a transaction, and cannot print after a successful transaction. The production version of the system cannot use this method to intercept logs (the reason is that the POS machine stores important information such as merchant terminal information and configuration files. This information is related to the national financial security and the people's property security, so the production version of the POS system blocks the adb function). However, if there is no log to help, it is difficult to quickly locate the problem and solve the problem in time, which will affect production. Problems with the application after release So a method is needed to intercept the logs of the application on the smart POS (production system). Summary of the invention

[0003] The purpose of the present invention is to provide a POS machine log acquisition method based on Java language, so as to solve the above-mentioned problems existing in the prior art.

[0004] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0005] A POS machine log acquisition method based on Java language, comprising the following steps:

[0006] S1, define the log editing method and encapsulate it as "data tool class LogUtils.java";

[0007] S2, write a custom broadcast receiver LogBroadcastReceiver.java for calling LogUtils, and package the LogBroadcastReceiver.java and the LogUtils.java into Log.jar;

[0008] S3, developing a tool application MLog.apk with a function of sending a custom broadcast based on the Log.jar;

[0009] S4, add Log.jar and tool application to the application to obtain POS machine logs, add the permission of Log.jar to read SD card; statically register the custom broadcast receiver on the application to obtain POS machine logs, and then call the required Log log editing method;

[0010] S5, using the tool application MLog.apk to send a custom broadcast, the application to be used to obtain the POS machine log receives the custom broadcast, and calls the log editing method in LogUtils.java according to the control parameter information in the custom broadcast, thereby controlling the generation of the POS machine log file.

[0011] Preferably, the method for editing the Log in step S1 includes: a method writeLog for writing the Log to the SD card, a method isWrite for setting whether the log file is written to the SD card, a method setLogPath for setting the path where the log file is saved to the SD card, and a method deleteLogBefor for deleting the previous log.

[0012] Preferably, the information received in the custom broadcast receiver in step S2 includes but is not limited to a method for whether to enable recording of POS machine logs, a method for whether to delete previous POS machine logs, and a method for recording the acquired POS logs in a certain path.

[0013] Preferably, the permission added to the Log.jar to read the SD card in step S4 is specifically the permission to read and write the storage in the POS machine.

[0014] Preferably, the control parameter information in the custom broadcast sent by the tool application in step S5 includes, but is not limited to, a parameter for whether to write a file, a parameter for setting a log file save path, and a parameter for whether to delete a previous POS log.

[0015] Preferably, the POS machine log acquisition method based on Java language also includes:

[0016] S6, import the generated POS machine log file into the storage medium through the OTG line, or upload the generated log file to the server through the tool application MLog.apk.

[0017] The beneficial effects of the present invention are:

[0018] The present invention discloses a POS machine log acquisition method based on Java language. The method controls the log program on the POS machine by sending a custom broadcast, so as to successfully acquire the intelligent POS machine production system log. The adopted tool application MLog.apk can conveniently control whether to generate a log file. Closing the log file when it is not needed can save the resources of the POS machine system. The method application is simple and fast to operate. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a flow chart of a POS machine log acquisition method based on Java language provided in Example 1; DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation methods described herein are only used to explain the present invention and are not used to limit the present invention.

[0021] Example 1

[0022] This embodiment provides a POS machine log acquisition method based on Java language, such as Figure 1 As shown, the following steps are included:

[0023] S1, define the editing methods of Log, including the writeLog method for writing Log to SD card, isWrite method for setting whether the log file is written to SD card, setLogPath method for setting the path of the log file to SD card, and deleteLogBefor method for deleting the previous log. The above contents are encapsulated as "data tool class LogUtils.java" through the function content provided by Google platform;

[0024] S2, write a custom broadcast receiver LogBroadcastReceiver.java for calling LogUtils, including whether to start recording POS machine logs, whether to delete previous POS machine logs, and the method of recording the acquired POS logs in what path; package the LogBroadcastReceiver.java and the LogUtils.java into Log.jar;

[0025] S3, developing a tool application MLog.apk with a function of sending a custom broadcast based on the Log.jar;

[0026] S4, add Log.jar and tool application MLog.apk to the application to obtain the POS machine log, and add the permission of Log.jar to read the SD card in the POS machine; statically register the custom broadcast receiver on the application to obtain the POS machine log, and then call the required Log log editing method; the method called here can be selected and adjusted according to actual needs;

[0027] S5, using the tool application MLog.apk to send a custom broadcast, the application to be used to obtain the POS machine log receives the custom broadcast, and calls the log editing method in LogUtils.java according to the control parameter information in the custom broadcast, thereby controlling the generation of the POS machine log file;

[0028] The control parameters include, but are not limited to, parameters for writing files, parameters for setting the log file save path, and parameters for deleting previous POS logs. The control parameter information can be set according to application requirements.

[0029] S6, import the generated POS machine log file into the storage medium through the OTG line, or upload the generated log file to the server through the tool application MLog.apk.

[0030] By adopting the above technical solution disclosed in the present invention, the following beneficial effects are obtained:

[0031] The present invention discloses a POS machine log acquisition method based on Java language. The method controls the log program on the POS machine by sending a custom broadcast, so as to successfully acquire the intelligent POS machine production system log. The adopted tool application MLog.apk can conveniently control whether to generate a log file. Closing the log file when it is not needed can save the resources of the POS machine system. The method application is simple and fast to operate.

[0032] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be considered as the scope of protection of the present invention.

Claims

1. A POS machine log acquisition method based on Java language, characterized in that: The following steps are involved: S1, define the editing method of Log log and encapsulate it into "data tool class LogUtils.java"; S2, write a custom broadcast receiver LogBroadcastReceiver.java for calling LogUtils, and package the LogBroadcastReceiver.java and the LogUtils.java into Log.jar; S3, developing a tool application MLog.apk with a function of sending a custom broadcast based on the Log.jar; S4, add Log.jar and tool application MLog.apk to the application to obtain the POS machine log, and add the permission for the Log.jar to read the SD card; statically register the custom broadcast receiver on the application to obtain the POS machine log, and then call the required Log log editing method; S5, using the developed tool application MLog.apk to send a custom broadcast to the application to obtain the POS machine log, the application to obtain the POS machine log receives the custom broadcast, and calls the log editing method in the data tool class LogUtils.java in Log.jar according to the control parameter information set in the custom broadcast, thereby controlling the generation of the POS machine log file; The methods for editing the Log in step S1 include but are not limited to: writeLog, a method for writing the Log to the SD card; isWrite, a method for setting whether the log file is written to the SD card; setLogPath, a method for setting the path where the log file is saved to the SD card; and deleteLogBefor, a method for deleting the previous log. The information received in the custom broadcast receiver in step S2 includes but is not limited to a method for whether to enable recording of POS machine logs, a method for whether to delete previous POS machine logs, and a method for recording the acquired POS machine logs in a certain path; In step S4, the permission for Log.jar to read the SD card is specifically the permission to read and write the storage in the POS machine. The control parameter information in the custom broadcast sent by the tool application MLog.apk in step S5, wherein the control parameters include but are not limited to: whether to write a file, whether to set the log file save path, and whether to delete the previous POS log; the control parameter information can be set according to the application requirements; The POS machine log acquisition method based on Java language also includes: S6, import the generated POS machine log file into the storage medium through the OTG line, or upload the generated log file to the server through the tool application MLog.apk.