A kind of method that realizes number tracking in the external interface of telecom operation system
Technical field
The present invention relates to the communications field, specifically, relate to a kind of number track side who comprises a large amount of Real time request systemsMethod, the method realizes the tracking to certain particular number by log, is a kind of side that verifies business and uniting and adjustment testMethod.
Background technology
At present, the enterprise transformation of China Telecom has driven the fast development of enterprise, and the value-added service of China Telecom is also continuousIncrease. Present stage, the number tracking in telecom operation system is the mode of log4j, and this mode is in use openedThe personnel of sending out find that there is larger leak.
Conventionally when developer uses the mode of log4j to test oneself in this locality, because the just request of a business, for canTo find out and the information of system interaction, can in program, print a lot of log informations, but after reaching the standard grade, complete in order to printDaily record, can only be in few time period of portfolio, such as 3:00 AM all 4 during this period of time, daily record rank is adjusted from ERROR rankWhole is INFO rank. When portfolio is large, the burden of system is original just heavier, if daily record rank is turned down, a large amount ofWrite journal file operation and can make the burden of system heavier, have the overtime risk of system request, the printing of daily record can becomeThe one burden of system, thus can be by higher the setting of daily record rank, and the log information that a lot of developers print can be in daily recordIn file, print.
In the time there is some problem in system, for the performance issue of quick positioning system is (as the feelings that take of CPU and internal memoryCondition etc.) and the logical problem of demand, can need the daily record of some printings as a reference, now this traditional log recordingThe mode of log4j can cause system performance problems, so can not allow daily record rank to be set to info or this class of debugLow rank, and if be higher level by daily record grade setting, so a lot of log informations cannot be collected.
Summary of the invention
The object of the invention is in the system of this large visit capacity of telecom operation, by following the tracks of some number transacting businessWhole flow process, carry out orientation problem easily or carry out the uniting and adjustment of system and a kind of convenience of providing is high, system risk is low,Number tracking simple to operate.
Technical scheme of the present invention is:
In the external interface of telecom operation system, realize the method that number is followed the tracks of, for entering according to the number of requestLine number code tracking, described method is applied to the system of telecommunication service support and charging, the specific implementation step of this number trackingSuddenly comprise:
External interface service end in A, startup telecom operation system;
B, start number monitor service end, number monitor service end be used for monitoring the process of external interface service end and forReceiving number is followed the tracks of the number of client and is followed the tracks of request;
C, carry out file configuration at number monitor service end, comprising: set up one for adding number to be trackedNumber empty queue, check whether the port of number monitor service end is occupied, set number and follow the tracks of automatically and close by query statementThe time of closing;
D, in the order line of number monitor service end, add to be tracked number in number empty queue by shell-commandCode;
E, startup number are followed the tracks of client, and the number that input request is followed the tracks of, checks the number in this number and number queueWhether mate, if so, this thread is can track thread, and can print this daily record; If not, this thread is can not tracker wireJourney, does not have the daily record that can print.
Described external interface comprises: Web service interface, UIP interface etc.
When described number monitor service end sends shell-command, first can set up a short connection to external interface,And sending dependent instruction, number monitor service end is received after instruction, and this number is added in number empty queue.
Whether described inspection port is occupied, is to check and be examined port with netstat – an|grep statementWhether occupied.
Described setting number is followed the tracks of the time of automatically closing, by revise traceTimeOut in configuration fileValue is determined.
Described can track thread, before printing, need be ERROR rank by daily record rank adjusting at print log place.
Described number is followed the tracks of the time of closing, and it is characterized in that, can also directly close by shell-command.
Beneficial effect of the present invention:
The present invention can be in the situation that not adjusting system journal rank, as long as the number that needs are followed the tracks of passes through shellOrder joins can be followed the tracks of in number queue, and system can be recorded to journal file by the processing trace logs of this number automatically, thisThe daily record amount that sample is printed can be not a lot, can affect hardly the performance of system, and the advantage of doing is like this mainly simple to operate, sideJust, and very little on the impact of system, do not have system risk.
Brief description of the drawings
Fig. 1 is the signal of a kind of method that realizes number tracking in the external interface of telecom operation system of the present inventionFigure.
Fig. 2 is the detailed place of a kind of method that realizes number tracking in the external interface of telecom operation system of the present inventionReason flow chart.
Detailed description of the invention
Below in conjunction with accompanying drawing, the preferred embodiments of the present invention are described, should be appreciated that embodiment described hereinOnly, for description and interpretation the present invention, be not intended to limit the present invention.
In the external interface of telecom operation system, realize the method that number is followed the tracks of, please for basis
The number of asking carries out number tracking, and described method is applied to the system of telecommunication service support and charging, and this number is followedThe specific implementation step of track method comprises:
External interface service end in A, startup telecom operation system;
B, in external interface server processes, starting number monitor service end can be automatically, and number monitor service end is used for prisonListen the process of external interface service end and follow the tracks of the number tracking request of client for receiving number;
C, carry out file configuration at number monitor service end, comprising: automatically set up a number empty queue, check numberWhether the port of code monitor service end occupied, set number follows the tracks of time of automatically closing etc.;
D, in the order line of number monitor service end, add to be tracked number in number empty queue by shell-commandCode;
E, startup number are followed the tracks of client, and the number that input request is followed the tracks of, checks the number in this number and number queueWhether mate, if so, this thread is can track thread, and can print this daily record; If not, this thread is can not tracker wireJourney, does not have the daily record that can print.
The precondition of this method is:
(1) increase configuration file TraceServer.xml, be mainly used for defining host to each service end process numberCode monitoring server. Whether the port that should be noted 32001,32002 these two number monitor service ends before configuration is occupied, asFruit is occupied, just changes the port arrangement in TraceServer.xml. Can use netstat – an|grep32001 check that whether 32001 is occupied.
(2), in TraceServer.xml, can tracking be set by the value of amendment traceTimeOut and automatically closeTime.
(3) under %ZsmartHome% catalogue, increase the shell file of trc.
(4) WebService part, the web.xml in/ocswebservices/WEB-INF increases configuration:
<servlet>
<servlet-name>WsMonitorService</servlet-name>
<servlet-class>com.ztesoft.zsmart.bss.ws.WSNbrTracerServlet</servlet-class>
<load-on-startup>500</load-on-startup>
</servlet>
For WebService, by web.xml, increase a servlet who moves while startup, open at tomcatWhen moving, the configuration of reading 902 these adapter in TraceServer.xml, monitors at 32002 startup numbers
The log of WebService is arranged to ERROR rank
Log4j.properties file under WebService catalogue arranges as follows
log4j.logger.com.ztesoft.zsmart=ERROR,A4
If the daily record rank of the sqllog in log4j.properties file is set up meeting error, number is followed soTrack function also will affect this sqllog.
Impact on sqllog daily record: when sqllog daily record rank is set to after error, if belong to trackedNumber can print detailed daily record in the daily record of sqllog. If the number that right and wrong are tracked, sqllog does not have soDaily record.
log4j.logger.SqlLog=ERROR,SQLLOG
Use the shell-command interpolation of trc or the concrete operations of deletion number as follows:
Trcxxxx: be mainly to trigger client to go for and ask service end, number is added and can follow the tracks of number queue.
Trcxxxxoff: be that number is shifted out from can follow the tracks of number queue, follow-up log recording will can not established againPut daily record rank.