Summary of the invention
At the problems referred to above, main purpose of the present invention provides a kind of log system that can select the log information way of output according to the daily record grade flexibly;
Another purpose of the present invention provides a kind of log system using method that is freely defined log information classification and grade by the user.
In order to realize above-mentioned main purpose, log system provided by the invention comprises the log store unit, the log server unit, the daily record client unit, the log interface unit, log store unit wherein, the log server unit is arranged on the server, the daily record client unit, the log interface unit is arranged in the business procedure unit, log store unit and a plurality of business procedure terminal are carried out information exchange, be used to store a plurality of business procedure terminals daily record Rule Information separately, log server unit and log store unit carry out information exchange, be used to receive the daily record Rule Information of business procedure terminal, and the daily record Rule Information is sent to the daily record client unit, the daily record client unit is carried out information exchange by log interface unit and business procedure unit, be used to receive log category and class information that the business procedure unit sends, and determine the way of output of log information according to log category and class information and daily record Rule Information.
By such scheme as seen, after the daily record client unit of log system receives the log category and class information that the business procedure unit sends, will be according to the classification and the class information of daily record, and determine the way of output of log information in conjunction with the daily record Rule Information.Because the classification of daily record and class information are by the business procedure terminal definitions, promptly the user can freely define the classification and the grade of log information, therefore, also just can select the way of output of log information neatly.
A preferred scheme is that the log interface unit comprises verification and encrypting module, is used for log information calculation check sign indicating number and encryption to receiving.Like this, the log information that the daily record client unit receives all passes through encryption, can prevent effectively that log information from being distorted, and improves the fail safe of log system.
For realizing another above-mentioned purpose, above-mentioned log system using method provided by the invention comprises the log category and the class information of each business procedure unit of each this business procedure terminal of business procedure terminal definitions;
Set up the annexation of log store unit and a plurality of business procedure terminals, each business procedure terminal of registration is given each business procedure terminal with unique ID number, and is write the daily record Rule Information of each business procedure terminal in the log store unit;
The business procedure unit sends the information contain business procedure Termination ID number and the log information that comprises log category, grade by the log interface unit to the daily record client unit;
The daily record client unit is according to the business procedure Termination ID in the described information number, obtain the daily record Rule Information of corresponding business procedure terminal to the log store unit by the log server unit, and determine the way of output of log information according to the daily record Rule Information of log category, class information and corresponding business procedure terminal, the daily record client unit is exported log information according to above-mentioned definite way of output.
This shows, log system does not have division log information category and grade in advance, but receive by custom system, be business procedure terminal definitions log category and grade, and after receiving log category and class information, log system is determined the way of output of log information according to log category and class information.Like this, log category, the dissimilar log information of class information differentiation that the user can be by freely defining, and utilize flexibly the way of output can check dissimilar log informations easily.
Embodiment
Referring to Fig. 1, log system of the present invention comprises log interface unit 12,32, daily record client unit 13,33, log server unit 21, log store unit 22, log management unit 23.Wherein, log interface unit 12 is arranged in the business procedure terminal 1 with daily record client unit 13, log interface unit 32 is arranged in the business procedure terminal 3 with daily record client unit 33, and log server unit 21, log store unit 22 and log management unit 23 are arranged in the server 2.
As seen from Figure 1, server 2 is connected with two business procedure terminals 1,3, and during practical application, server 2 can also be connected with more business process terminal.In the present embodiment, business procedure terminal 1,3 is a computer, and during practical application, the business procedure terminal can also be storage mediums such as the webserver or magnetic tape station.
Operation has a plurality of different business procedure unit 11 in the business procedure terminal 1, and these business procedure unit 11 produce log information in running, and log information is sent to log system.In the present embodiment, business procedure unit 11 passes through log interface unit 12 to daily record client unit 13 transmission information.
Identical, the business procedure unit 31 of business procedure terminal 3 also passes through log interface 32 to daily record client unit 33 transmission information.
Each the business procedure terminal 1,3 that is connected to log store unit 22 all need be registered in log store unit 22, business procedure terminal 1,3 is after registration, being composed with unique ID number, is 001 as ID number of business procedure terminal 1, is for the ID of business procedure terminal No. 3 002 etc.
In the present embodiment, each business procedure terminal 1,3 all has the daily record rule of oneself, and these daily record Rule Informations are stored in the log store unit 22.Like this, the daily record rule of all business procedure terminals 1,3 is by server 2 unified managements.Log server unit 21 can be inquired about the daily record Rule Information of different business process terminals 1,3 to log store unit 22, and the daily record Rule Information is sent in the daily record client unit 13,33.
The log interface unit 12 that is provided with in the business procedure terminal 1 is information exchange inlets of log system and business procedure unit 11, the information that business procedure unit 11 produces in running, comprise that daily record starting command, data command and daily record receive order etc., all are sent in the daily record client unit 13 by log interface unit 12.
Log interface unit 12 is provided with verification and encrypting module, is used for the log information calculation check sign indicating number to receiving, and log information is carried out encryption, prevents that log information from being distorted, and improves the reliability of log information storage.Certainly, because the 12 pairs of log informations in log interface unit carry out encryption, when daily record client unit 13 or log server unit 21 output journal information, need carry out corresponding decryption processing to log information.
Daily record client unit 13 and log interface 12 communications, the message mechanism that both use Windows operating system carries out information exchange, receives the information that log interface 12 sends.Simultaneously, daily record client unit 13 can also be carried out communication by the log server unit 21 of Socket communication mechanism and server 2, and obtains the daily record rule of different business process terminal 1,3 by log server unit 21.And daily record client unit 13 is determined the way of output of log information according to log category, class information and daily record Rule Information that business procedure unit 11 sends.
In the present embodiment, the daily record way of output has multiple, can export local file, local data base or server file, server database to and does not store etc.If log information exports local file or local data base to, then daily record client unit 13 exports business procedure terminal 1 to after log information is deciphered, if log information exports server file or server database to, daily record client unit 13 is sent to log server unit 21 with log information.
Log server unit 21 is connected with log store unit 22 and carries out information exchange, and can obtain the daily record Rule Information of different business process terminal 1,3 to log store unit 22, and sends the daily record Rule Information to daily record client unit 13,33.And log server unit 21 will be sent to log store unit 22 after will exporting the log information deciphering of server file or server database to.
Log management unit 23 is connected with log store unit 22 and carries out information exchange, manage being stored in the log information in the log store unit 22 and the daily record Rule Information of each business procedure terminal 1,3, comprise check log information, to log information back up, processing such as deletion.Certainly, in the present embodiment, log management unit 23 is arranged in the same server 2 with log store unit 22, during practical application, log management unit 23 also can be arranged on another server or the computer, as long as log management unit 23 is connected with log store unit 22 and log information, daily record Rule Information are managed.
The log interface unit 32 of business procedure terminal 3 and the function of daily record client unit 33 are consistent with log interface unit 12, daily record client unit 13 functions of business procedure terminal 1, do not repeat them here.
Illustrate below in conjunction with Fig. 2 how log system of the present invention works.Before the log system work, log category, the class information of business procedure terminal 1,3 each business procedure unit 11,31 of definition.Then a plurality of business procedure terminals 1,3 are connected in the log system, promptly set up the annexation of business procedure terminal 1,3 and log store unit 22, and in log store unit 22 each business procedure terminal 1,3 of registration, give each business procedure terminal 1,3 unique ID number.Then, define the daily record rule of each business procedure terminal 1,3, the daily record Rule Information is stored in the log store unit 22.The daily record rule of business procedure terminal 1,3 comprises that this business procedure terminal correspondence is different classes of, the different way of outputs is arranged during the log information of grade, and the way of output of log information can be defined by user flexibility.
Business procedure unit 11 transmission log informations with business procedure terminal 1 are example below, and the workflow of log system is described.
After business procedure unit 11 brings into operation, execution in step S1, by log interface unit 12 to daily record client unit 13 transmission information, this moment business procedure unit 11 to log system be to send starting command, this starting command includes the information of business procedure terminal 1ID number at 11 places, business procedure unit.
After log interface unit 12 receives the information of business procedure unit 11 transmissions, execution in step S2, judge whether this information is log information, if log information, execution in step S3 then, to log information calculation check sign indicating number, and log information carried out encryption, then log information is sent to daily record client unit 13; If not log information then is sent to daily record client unit 13 with the information that receives.
The information that the back sends because business procedure unit 11 brings into operation is starting command, be not log information, so log interface unit 12 directly is sent to daily record client unit 13 with the starting command information that receives.
After daily record client unit 13 received starting command information, execution in step S4 carried out the judgement of information type.Because this information is starting command, then daily record client unit 13 execution in step S5 create the example that is connected with business procedure unit 11.Then, execution in step S7 sends to log server unit 21 with starting command information.
After log server unit 21 receives starting command information, execution in step S9, carry out the judgement of information type, because this information is starting command, execution in step S10 then creates the example that is connected with business procedure unit 11, and execution in step S11, obtain corresponding daily record Rule Information according to the business procedure Termination ID in the starting command information number to log store unit 22, and the daily record Rule Information is sent to daily record client unit 13.
At last, log system execution in step S14 judges whether success of start-up course, if success then finishes start-up course, if unsuccessful, execution in step S15 then discharges the example that is connected of log server unit 21 and 13 foundation of daily record client unit.
After the start-up course success, business procedure unit 11 sends data command, just execution in step S1 by log interface unit 12 to daily record client unit 13.Include log information in the data command that business procedure unit 11 sends, log information comprises log category, class information.Log category, class information are by 1 definition of business procedure terminal, log category, grade that business procedure terminal 1 produces according to the property definition different business process unit 11 of different business process unit 11, and when sending log information, log category, class information are sent in the lump.Preferably, log category, daily record class information all use 1 byte representation.
After log interface unit 12 received data command, execution in step S2 was judged as execution in step S3 behind the log information, to log information calculation check sign indicating number, and carries out encryption, and the log information after encrypting is sent to daily record client unit 13.
After daily record client unit 13 receives log information, execution in step S4, after being judged as data command, execution in step S6, according to log category, class information, and in conjunction with the daily record Rule Information of business procedure terminal, determine the way of output of log information, promptly definite log information is exported in which way, as exports in local file, local data base, server file, the server database, or do not store etc.
Then, daily record client unit 13 execution in step S8 judge whether log information outputs to server file or server database, if be sent to server, then execution in step S7 is sent to log server unit 21 with log information; If not be sent to server, then execution in step S17 will export business procedure terminal 1 to after the log information deciphering.Like this, promptly finish the output of local log information.
After log server unit 21 receives the log information of daily record client unit 13 transmissions, execution in step S9, judge information type, and after judging that this information is data command, execution in step S13 exports log store unit 22 to after exporting the log information deciphering of server file or server database to.After finishing above-mentioned steps, log system is promptly finished the output of network log information.
After finishing the output of log information, business procedure unit 11 sends the finish command by log interface unit 12 to daily record client unit 13, after 13 judgements of daily record client unit receive the finish command, execution in step S7, the information of the finish command is sent to log server unit 21, after 21 judgements of log server unit receive the finish command, execution in step S12,21 end of log server unit are connected with business procedure unit 11, and discharge the connection example.Then, daily record client unit 13 execution in step S16, end is connected with business procedure unit 11, discharges to connect example.
By such scheme as seen, log system can allow business procedure terminal 1 freely define the classification and the grade of business procedure unit 11, and the way of output that daily record client unit 13 can be determined log information according to the classification and the grade of daily record, like this, log system can freely be defined the classification and the grade of log information by the user, and select the way of output of the log information of different classes of, grade flexibly, make things convenient for the user to check log information.
And business procedure unit 11 starts and the end log system works by sending starting command and the finish command.In addition, the log interface unit 12 of log system prevents that also to log information calculation check sign indicating number and carry out encryption log information from being distorted, and improves the fail safe of log system.
Certainly, the foregoing description only is the preferred embodiment of the present invention, during practical application, the present invention also has more the change, for example increase or reduce the way of output of partial log information, the information that comprises the daily record way of output in the log information that the business procedure unit sends is perhaps used the information of a plurality of byte representation log category, grade, and these change does not influence enforcement of the present invention.
At last; it is emphasized that; the invention is not restricted to above-mentioned execution mode, also should be included in protection scope of the present invention the minor variations such as change of the communication modes between change, business procedure unit and the log system of log information encryption method such as change, the log interface unit of the daily record rule of different business process terminal correspondence.