CN103095491B - A kind of log services processing method and processing device - Google Patents
A kind of log services processing method and processing device Download PDFInfo
- Publication number
- CN103095491B CN103095491B CN201210583988.XA CN201210583988A CN103095491B CN 103095491 B CN103095491 B CN 103095491B CN 201210583988 A CN201210583988 A CN 201210583988A CN 103095491 B CN103095491 B CN 103095491B
- Authority
- CN
- China
- Prior art keywords
- daily record
- osgi
- log services
- factory
- log
- 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.)
- Active
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
This application provides a kind of log services processing method, including: after assembly starts, transmit the context object factory to not common service platform OSGi type daily record of described assembly;Preserve the context object factory to described non-OSGi type daily record of described assembly;Judge that log services corresponding to the factory of described non-OSGi type daily record is the most registered for OSGi type log services;In the case of the log services that the factory of described non-OSGi type daily record is corresponding is registered, return described OSGi type log services;In the case of the log services that the factory of described non-OSGi type daily record is corresponding is unregistered, described log services is registered as OSGi type log services.Therefore, the application can integrated polytype log services, after integrated polytype log services, the requirement that different java application based on OSGi selects to be suitable for oneself log services and apply it can be met according to oneself demand.
Description
Technical field
The present invention relates to log services technical field, particularly relate to a kind of log services processing method and processing device.
Background technology
OSGi(public service platform, open Service Gateway Initiative) it is clothes based on Java
Business specification, it is to need long-play for those, dynamically updates and the system system the least on the impact of running environment
Fixed.Further, OSGi provides service to Java, and these services make Java become the first-selected environment of Integrated Simulation and software development.
Wherein, OSGi alliance has been developed for the standard package interface of a lot of public function such as such as daily record, safety etc..
Current log services only has SLF4J to be to run to the daily record plug-in unit in OSGi.Java based on OSGi should
This log services can be applied by program.
And common other log services such as java.util.logging, simpleLogger, log4j etc. is the most no
Can run in OSGi, so also cannot be applied by java application based on OSGi.Therefore, it is badly in need of a kind of log services
Processing method, is converted to the log services being not based on OSGi log services based on OSGi, makes based on OSGi further
Java application can call the log services after conversion by a kind of general log interface.
Summary of the invention
For solving above-mentioned technical problem, the embodiment of the present application provides a kind of log services processing method, to reach integrated many
The purpose of the log services of type, technical scheme is as follows:
A kind of log services processing method, including:
After assembly starts, transmit the context object work to not common service platform OSGi type daily record of described assembly
Factory;
Preserve the context object factory to described non-OSGi type daily record of described assembly;
Judge that log services corresponding to the factory of described non-OSGi type daily record is the most registered to take for OSGi type daily record
Business;
In the case of the log services that the factory of described non-OSGi type daily record is corresponding is registered, return described OSGi class
Type log services;
In the case of the log services that the factory of described non-OSGi type daily record is corresponding is unregistered, by described log services
Be registered as OSGi type log services.
Preferably, it is judged that the log services that the factory of described non-OSGi type daily record is corresponding is the most registered for OSGi type
Log services includes:
Judge that according to log read service interface LogReaderService the factory of described non-OSGi type daily record is corresponding
Log services the most registered for OSGi type log services;
Described log read service interface LogReaderServic judges described non-according to type and the version number of daily record
The log services that the factory of OSGi type daily record is corresponding is the most registered for OSGi type log services.
Preferably, in the case of the log services that the factory of described non-OSGi type daily record is corresponding is unregistered, by described
Log services is registered as OSGi type log services and includes:
Judge whether log services corresponding to the factory of described non-OSGi type daily record is present in public service platform OSGi
In;
The log services corresponding in the factory of non-OSGi type daily record does not exists in the situation in public service platform OSGi
Under, add log services corresponding to the factory of described non-OSGi type daily record the factory of described non-OSGi type daily record is corresponding
Log services be registered as OSGi type log services;
In the case of the log services that the factory of non-OSGi type daily record is corresponding is present in public service platform OSGi,
Log services corresponding for the factory of described non-OSGi type daily record is registered as OSGi type log services.
Preferably, also include:
Deriving the interface of log services corresponding to the factory of described non-OSGi type daily record, described interface carries version
Number.
Preferably, also include:
After the log services registration that the factory of described non-OSGi type daily record is corresponding, exporting described non-OSGi type day
During the log information of the log services record that the factory of will is corresponding, daily record audiomonitor interface LogListener sends journal entries
The journal entries of interface LogEntry type, to daily record service interface LogService, obtains described journal entries interface
The log information that LogEntry object is corresponding;
Also include: after the log services registration that the factory of described non-OSGi type daily record is corresponding, in the way of pure service
Or in the way of embedding, load described log services.
A kind of log services processing means, including:
Transfer unit, after starting at assembly, transmits the context object of described assembly to not common service platform
The factory of OSGi type daily record;
Memory element, for preserving the context object of the assembly of transfer unit transmission to described non-OSGi type daily record
Factory;
First judging unit, the most registered for judging log services corresponding to the factory of described non-OSGi type daily record
For OSGi type log services;
Return unit, corresponding for the factory that judged result is described non-OSGi type daily record at the first judging unit
In the case of log services is registered, return described OSGi type log services;
First registering unit, for the factory pair that judged result is described non-OSGi type daily record at the first judging unit
In the case of the log services answered is unregistered, described log services is registered as OSGi type log services.
Preferably, the first judging unit is specifically for judging institute according to log read service interface LogReaderService
The log services stating the factory of non-OSGi type daily record corresponding is the most registered for OSGi type log services;
First judging unit judges the work of described non-OSGi type daily record specifically for the type according to daily record and version number
Log services corresponding to factory is the most registered for OSGi type log services.
Preferably, the first registering unit includes: the second judging unit, adding device and the second registering unit;
Wherein, whether the second judging unit, for judging log services corresponding to the factory of described non-OSGi type daily record
It is present in public service platform OSGi;
Adding device, for the daily record corresponding in the factory that judged result is non-OSGi type daily record of the second judging unit
In the case of service does not exists in public service platform OSGi, add the daily record that the factory of described non-OSGi type daily record is corresponding
Service;
Second registering unit, for registering the daily record that the factory of the non-OSGi type daily record that described adding device adds is corresponding
Service or for being present in the log services that the factory that judged result is non-OSGi type daily record of the second judging unit is corresponding
In the case of in public service platform OSGi, register the log services that the factory of described non-OSGi type daily record is corresponding.
Preferably, also include:
Lead-out unit, for deriving the interface of log services corresponding to the factory of described non-OSGi type daily record, described in lead
Go out unit specifically for deriving the interface of log services corresponding to the factory of described non-OSGi type daily record carrying version number.
Preferably, also include:
Processing unit, after the log services registration that the factory in described non-OSGi type daily record is corresponding, in output institute
When stating the log information of log services record corresponding to the factory of non-OSGi type daily record, daily record audiomonitor interface
The journal entries of LogListener transmission journal entries interface LogEntry type, to daily record service interface LogService, obtains
Take the log information that described journal entries interface LogEntry object is corresponding;
Also include:
Loading unit, after the log services registration that the factory in described non-OSGi type daily record is corresponding, with pure service
Mode or by embedding in the way of load described log services.
Compared with prior art, the application provides the benefit that:
In this application, the log services of non-OSGi type can be created in OSGi and in OSGi, register this non-OSGi
The log services of type, is converted to log services based on OSGi by the log services of this non-OSGi type, reaches integrated multiple
The purpose of the log services of type, after integrated polytype log services, can meet different Java application journey based on OSGi
Sequence selects the requirement being suitable for the log services of oneself and applying it according to oneself demand.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present application or technical scheme of the prior art, below will be to embodiment or existing
In having technology to describe, the required accompanying drawing used is briefly described, it should be apparent that, the accompanying drawing in describing below is only this
Some embodiments described in application, for those of ordinary skill in the art, on the premise of not paying creative work,
Other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is a kind of flow chart of a kind of log services processing method that the application provides;
Fig. 2 is, in a kind of log services processing method that the application provides, unregistered log services is registered as OSGi class
A kind of flow chart of type log services;
Fig. 3 is the another kind of flow chart of a kind of log services processing method that the application provides;
Fig. 4 a is a kind of structural representation of a kind of log services processing means that the application provides;
Fig. 4 b is the one of the particular make-up of the first registering unit in a kind of log services processing means that the application provides
Structural representation;
Fig. 5 is the another kind of structural representation of a kind of log services processing means that the application provides.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is carried out clear, complete
Describe, it is clear that described embodiment is only some embodiments of the present application rather than whole embodiments wholely.Based on
Embodiment in the application, it is every other that those of ordinary skill in the art are obtained under not making creative work premise
Embodiment, broadly falls into the scope of the application protection.
The application provides a kind of log services processing method, first after assembly starts, transmits the context of described assembly
Object, to the factory of not common service platform OSGi type daily record, secondly preserves the context object of described assembly to described non-
The factory of OSGi type daily record, then judging that log services corresponding to the factory of described non-OSGi type daily record is the most registered is
OSGi type log services, in the case of the log services that the factory of described non-OSGi type daily record is corresponding is registered, returns
Described OSGi type log services, in the case of the log services that the factory of described non-OSGi type daily record is corresponding is unregistered,
Described log services is registered as OSGi type log services.A kind of daily record clothes that the application is provided by embodiment will be enumerated below
Business processing method is described in detail.
One embodiment
Refer to Fig. 1, it illustrates a kind of flow chart of a kind of log services processing method that the application provides, can wrap
Include following steps:
Step S11: after assembly starts, transmit the context object of described assembly to not common service platform OSGi type
The factory of daily record.
In the present embodiment, after starting the assembly in public service platform OSGi, by the group in public service platform OSGi
The context object of part is delivered to the factory of not common service platform OSGi type daily record.
After the context object of the assembly in receiving public service platform OSGi, not common service platform OSGi type day
The log services that the factory of will is corresponding just can be registered as OSGi type log services or from OSGi class by context object
Type log services reads the log services that the factory of this not common service platform OSGi type daily record is corresponding.
The context object of the assembly in public service platform OSGi is being delivered to not common service platform OSGi type
After the factory of daily record, perform step S12.
The log services that the factory of not common service platform OSGi type daily record is corresponding can use public service platform
Assembly in OSGi is to realize log services function.
Step S12: preserve the context object factory to described non-OSGi type daily record of described assembly.
After the factory of non-OSGi type daily record receives the context object of assembly in public service platform OSGi, protect
Deposit the context object of assembly in this public service platform OSGi.
Step S13: judge that log services corresponding to the factory of described non-OSGi type daily record is the most registered for OSGi class
Type log services.
Judge that log services corresponding to the factory of non-OSGi type daily record is the most registered former for OSGi type log services
Because: during application program usage log based on public service platform OSGi service, it is necessary to use OSGi type log services, i.e.
Use and be registered in the log services in public service platform OSGi.If the log services that the factory of non-OSGi type daily record is corresponding
Unregistered in public service platform OSGi, the log services that the factory of non-OSGi type daily record is corresponding just can not use public clothes
The assembly of the log services function that business platform OSGi provides, the log services that i.e. factory of this non-OSGi type daily record is corresponding is not
Can run in public service platform OSGi.Application program if based on public service platform OSGi uses this non-the most further
During log services corresponding to the factory of OSGi type daily record, application program based on public service platform OSGi will not obtain this public affairs
The daily record of record in the application program running of service platform OSGi altogether.
Wherein public service platform OSGi provides the function of service registry, to realize the factory pair of non-OSGi type daily record
The log services answered is registered as OSGi type log services.
In the present embodiment, it is judged that the log services that the factory of non-OSGi type daily record is corresponding is the most registered for OSGi class
Type log services can judge according to log read service interface LogReaderService.Wherein log read service interface
LogReaderService judges that log services corresponding to the factory of non-OSGi type daily record is the most registered for OSGi type day
The detailed process of will service is: service according to the name lookup log read of log read service interface LogReaderService
The service reference object of the service that interface LogReaderService is corresponding;When judging this service object not as sky, from non-
The context object preserved in the factory of OSGi type daily record obtains log read service interface LogReaderService class
The object of type;Usage log read service interface LogReaderService definition getlog() retrieval log read service connect
The journal entries that the object of mouthful LogReaderService type is corresponding, if include that this is non-in the journal entries retrieved
The log services that the factory of OSGi type daily record is corresponding, then illustrated log services corresponding to the factory of this non-OSGi type daily record
Registration, otherwise, illustrates that log services corresponding to the factory of this non-OSGi type daily record is unregistered.Judge process can be by following generation
Code realizes, and code is:
Getlog() daily record that the object of method retrieval log read service interface LogReaderService type is corresponding
The detailed process of entry can be: receivesLogReaderService interface realize classLogReaderServiceImpl passes through
The journal entries object that the mode of constructed fuction is transmitted;Obtain the journal entries that the journal entries object received is corresponding.
Retrieving can be realized by code below:
When application program based on OSGi applies log services corresponding to any one non-OSGi type daily record, can touch
Send out the log services that LogReaderService judges that this non-OSGi type daily record that application program based on OSGi is applied is corresponding
The most registered in OSGi.
Take it is of course also possible to judge that log services corresponding to OSGi type daily record is the most registered for OSGi type daily record
Business.The log services that judge process is corresponding with the factory judging non-OSGi type daily record is the most registered for OSGi type daily record clothes
The method of business is identical, does not repeats them here.
In the case of the log services that the factory that judged result is this non-OSGi type daily record is corresponding is registered, perform step
Rapid S14.
In the case of the log services that the factory that judged result is this non-OSGi type daily record is corresponding is unregistered, this is non-
The log services that the factory of OSGi type daily record is corresponding may be present in public service platform OSGi or be not present in public
In service platform OSGi.Whether the log services needing the factory judging described non-OSGi type daily record corresponding in this case deposits
Being in public service platform OSGi, the log services corresponding in the factory that judged result is this non-OSGi type daily record exists
Time in public service platform OSGi, perform step S15 and described log services is registered as OSGi type log services.Judging
Result is when the log services that the factory of this non-OSGi type daily record is corresponding is not present in public service platform OSGi, adds
The log services that the factory of described non-OSGi type daily record is corresponding, as shown in Figure 2.Wherein Fig. 2 is in non-OSGi type daily record
In the case of log services corresponding to factory is unregistered, described log services is registered as OSGi type log services a kind of in detail
Thin flow chart.Wherein, according to log services interface when adding log services corresponding to the factory of described non-OSGi type daily record
LogService adds the log services corresponding to factory of described non-OSGi type daily record.
Log services interface LogService adds the tool of the log services corresponding to factory of described non-OSGi type daily record
Body process is that the LogServiceImpl that realizes of log services interface passes through the log(of log services interface LogService definition)
Method, log information message when will call this log services, daily record rank level, this log services reference object
The message Throwable exception of ServiceRefence and band exception is encapsulated as a journal entries, and it is right i.e. to complete
The interpolation of the log services that the factory of described non-OSGi type daily record is corresponding.
The process wherein adding log services can be realized by code below:
Step S14: return described OSGi type log services.
In the present embodiment, return described OSGi type log services and i.e. return registration in public service platform OSGi
The log services that the factory of non-OSGi type daily record is corresponding.
Certainly, if it is determined that judged result be that log services corresponding to OSGi type daily record is registered for OSGi type day
Will services, then return the log services that this OSGi type daily record is corresponding.
Step S15: described log services is registered as OSGi type log services.
In the present embodiment, the service registration functionality in public service platform OSGi is capable of non-OSGi type daily record
Log services corresponding to factory or log services corresponding to OSGi type daily record be registered as OSGi type log services.
In said method step, the connecing of log services of registration can be derived in OSGi in the description information of assembly
Mouthful, and add different version numbers on the interface derived.In OSGi, the description information record of assembly exists
In MANIFEST.MF file.After the version number of the interface derived and export interface is recorded in MANIFEST.MF file,
Different assemblies in OSGi can select the export interface of different editions number to work together, and one of them assembly can only select
The export interface of one of them version in the export interface of the different editions number of record in MANIFEST.MF file, but other group
Part can select the export interface of other version.Thus, different application based on OSGi uses assemblies different in OSGi
When realizing log services, the assembly that export interface that different application based on OSGi can select different editions number is corresponding
Realize the log services of different editions.
Owing to, in said method step, the log services of non-OSGi type can be created in OSGi and registers in OSGi
The log services of this non-OSGi type, is converted to log services based on OSGi by the log services of this non-OSGi type, reaches
The purpose of integrated polytype log services, after integrated polytype log services, can meet difference based on OSGi
Java application selects the requirement being suitable for the log services of oneself and applying it according to oneself demand.
Further, owing in MANIFEST.MF file, record has and carries the export interface of version number, make based on OSGi
Different java applications can select same type but during the different log services of version, the log services of different editions
Can be properly functioning.
Another embodiment
In the present embodiment, on the basis of a kind of log services processing method shown in Fig. 1, another kind of daily record is expanded
Service processing method, detailed process refers to Fig. 3.A kind of log services processing method that wherein Fig. 3 provides for the application another
A kind of flow chart, may comprise steps of:
Step S31: after assembly starts, transmit the context object of described assembly to not common service platform OSGi type
The factory of daily record.
Step S32: preserve the context object factory to described non-OSGi type daily record of described assembly.
Step S33: judge that log services corresponding to the factory of described non-OSGi type daily record is the most registered for OSGi class
Type log services.
Step S34: return described OSGi type log services.
Step S35: described log services is registered as OSGi type log services 3
Step S31 is to step S11 in a kind of log services processing method shown in step S35 and Fig. 1 to step S15 phase
With, do not repeat them here.
Step S36: after the log services registration that the factory of described non-OSGi type daily record is corresponding, described non-in output
During the log information of the log services record that the factory of OSGi type daily record is corresponding, daily record audiomonitor interface LogListener sends out
Send journal entries interface LogEntry object to daily record service interface LogService, obtain described journal entries interface
The log information that LogEntry object is corresponding.
In the present embodiment, daily record audiomonitor interface LogListener is registered in log read service interface
In LogReaderServic, when the log information that application program based on OSGi requirement this application program of output is corresponding, can create
Building a new journal entries object, now daily record audiomonitor interface LogListener listens to the wound of new journal entries object
Build, the journal entries of a journal entries interface LogEntry type can be received, and this journal entries is sent to daily record clothes
Business interface LogService, after LogService receives this journal entries, this journal entries connects by calling journal entries
The method of mouth LogEntry definition, such as entry.getMessage (), entry.getLevel (), entry.getBundle ()
The relevant log information corresponding to this journal entries is obtained with entry.getException ().After acquisition, output should
The log information that journal entries is corresponding.Said process can be realized by logged method, and wherein, logged method is:
Any content wanted and realize can be added, such as by daily record literary composition in logged (LogEntry entry) method
Part content echo on control station, the System.out.println (entry.getMessage ()) in the most above-mentioned code.
In said method step, the non-OSGi type daily record that the log services of registration is i.e. registered in OSGi in OSGi
When corresponding log services or log services corresponding to OSGi type daily record are loaded, can in the way of pure service or with
Embedded mode is loaded.
Corresponding with the embodiment of a kind of log services processing method shown in Fig. 1, this application provides a kind of daily record clothes
A kind of structural representation of business processing means, refers to Fig. 4 a, and log services processing means includes that transfer unit 401, storage are single
Unit's the 402, first judging unit 403, return unit the 404, first registering unit 405 and lead-out unit 406.
Wherein transfer unit 401, after starting at assembly, transmit the context object of described assembly to not common service
The factory of platform OSGi type daily record.
In the present embodiment, after starting the assembly in public service platform OSGi, transfer unit 401 is by public service platform
The context object of the assembly in OSGi is delivered to the factory of not common service platform OSGi type daily record.
At transfer unit 401, the context object of the assembly in public service platform OSGi is delivered to not common service put down
After the factory of platform OSGi type daily record, trigger memory element 402.
Memory element 402, for preserving the context object of the assembly of transfer unit transmission to described non-OSGi type day
The factory of will.
After the factory of non-OSGi type daily record receives the context object of assembly in public service platform OSGi, deposit
Storage unit 402 preserves the context object of the assembly in this public service platform OSGi.
First judging unit 403, for having judged log services corresponding to the factory of described non-OSGi type daily record the most
Be registered as OSGi type log services.
When application program based on OSGi applies log services corresponding to any one non-OSGi type daily record, can touch
Send out the first judging unit 403 and judge that log services corresponding to this non-OSGi type daily record that application program based on OSGi is applied is
No registered in OSGi.
Take it is of course also possible to judge that log services corresponding to OSGi type daily record is the most registered for OSGi type daily record
Business.
In the present embodiment, the first judging unit 403 is specifically for according to log read service interface
LogReaderService judges that log services corresponding to the factory of described non-OSGi type daily record is the most registered for OSGi class
Type log services.
First judging unit 403 can also judge described non-OSGi type specifically for the type according to daily record and version number
The log services that the factory of daily record is corresponding is the most registered for OSGi type log services.
Return unit 404, for the factory that judged result is described non-OSGi type daily record at the first judging unit 403
In the case of corresponding log services is registered, return described OSGi type log services;
In the present embodiment, the OSGi type log services returning unit 404 return i.e. returns at public service platform
The log services that in OSGi, the factory of the non-OSGi type daily record of registration is corresponding.
Certainly, if the judged result of the first judging unit 403 log services that to be OSGi type daily record corresponding is registered
For OSGi type log services, then return the log services that this OSGi type daily record is corresponding.
First registering unit 405, is described non-OSGi type daily record for the judged result at the first judging unit 403
Log services corresponding to factory unregistered in the case of, described log services is registered as OSGi type log services.
In the present embodiment, the first registering unit 405 is capable of daily record corresponding for the factory of non-OSGi type daily record
Service or log services corresponding to OSGi type daily record are registered as OSGi type log services.
First registering unit 405 can be by the second judging unit 4051, adding device 4052 and the second registering unit 4053
Composition, as shown in Figure 4 b, wherein Fig. 4 b is a kind of structural representation of particular make-up of the first registering unit 405.
Wherein, the second judging unit 4051, for judging the log services that the factory of described non-OSGi type daily record is corresponding
Whether it is present in public service platform OSGi.
Adding device 4052, for the factory pair that judged result is non-OSGi type daily record at the second judging unit 4051
In the case of the log services answered does not exists in public service platform OSGi, add the factory pair of described non-OSGi type daily record
The log services answered.
Second registering unit 4053, for registering the factory pair of the non-OSGi type daily record that described adding device 4052 adds
The log services answered or for the day corresponding in the factory that the judged result of the second judging unit 4051 is non-OSGi type daily record
In the case of will service is present in public service platform OSGi, register the daily record that the factory of described non-OSGi type daily record is corresponding
Service.
Lead-out unit 406, for deriving the interface of log services corresponding to the factory of described non-OSGi type daily record, described
Lead-out unit 406 is specifically for deriving log services corresponding to the factory of described non-OSGi type daily record carrying version number
Interface.
In the present embodiment, on the basis of a kind of log services processing means shown in Fig. 4, another kind of daily record is expanded
Service processing device, concrete composition refers to Fig. 5.A kind of log services processing means that wherein Fig. 5 provides for the application another
A kind of structural representation, also includes on the basis of a kind of data interaction processing means shown in Fig. 4 a: processing unit 501 and adding
Carrier unit 502, wherein the first registering unit in the structural representation of a kind of log services processing means shown in Fig. 5 is wrapped equally
Include the second judging unit 4051 shown in Fig. 4 b, adding device 4052 and the second registering unit 4053.
Wherein, processing unit 501, after the log services registration that the factory in described non-OSGi type daily record is corresponding,
When exporting the log information of log services record corresponding to factory of described non-OSGi type daily record, daily record audiomonitor interface
The journal entries of LogListener transmission journal entries interface LogEntry type, to daily record service interface LogService, obtains
Take the log information that described journal entries interface LogEntry object is corresponding.
Loading unit 502, after the log services registration that the factory in described non-OSGi type daily record is corresponding, with pure clothes
Business mode or by embedding in the way of load described log services.
It should be noted that in this article, term " includes ", " comprising " or its any other variant are intended to non-row
Comprising of his property, so that include that the process of a series of key element, method, article or equipment not only include those key elements, and
And also include other key elements being not expressly set out, or also include intrinsic for this process, method, article or equipment
Key element.In the case of there is no more restriction, statement " including ... " key element limited, it is not excluded that including
State and the process of key element, method, article or equipment there is also other identical element.
Described above to the disclosed embodiments, makes professional and technical personnel in the field be capable of or uses the present invention.
Multiple amendment to these embodiments is apparent from for those skilled in the art, and as defined herein one
As principle can realize in other embodiments without departing from the spirit or scope of the present invention.Therefore, the present invention will
Will not be intended to be limited to the embodiments shown herein, and be to fit to consistent with principles disclosed herein and features of novelty
Widest range.
Claims (7)
1. a log services processing method, it is characterised in that including:
After assembly starts, transmit the context object factory to not common service platform OSGi type daily record of described assembly;
Preserve the context object factory to described non-OSGi type daily record of described assembly;
Judge that log services corresponding to the factory of described non-OSGi type daily record is the most registered for OSGi type log services;
In the case of the log services that the factory of described non-OSGi type daily record is corresponding is registered, return described OSGi type day
Will services;
In the case of the log services that the factory of described non-OSGi type daily record is corresponding is unregistered, described log services is registered
For OSGi type log services;
Wherein, the log services that the described factory judging described non-OSGi type daily record is corresponding is the most registered for OSGi type day
Will service includes the factory pair judging described non-OSGi type daily record according to log read service interface LogReaderService
The log services answered is the most registered for OSGi type log services;
The described factory's correspondence judging described non-OSGi type daily record according to log read service interface LogReaderService
The most registered process for OSGi type log services of log services be: according to log read service interface
The service of the service corresponding for name lookup log read service interface LogReaderService of LogReaderService is drawn
Use object;When judging this service object not as sky, the context object preserved from the factory of non-OSGi type daily record obtains
Take the object of log read service interface LogReaderService type;Usage log reads service interface
The object of getlog () the retrieval log read service interface LogReaderService type of LogReaderService definition
Corresponding journal entries, if include the daily record clothes that the factory of this non-OSGi type daily record is corresponding in the journal entries retrieved
Business, then illustrate that log services corresponding to the factory of this non-OSGi type daily record is registered, otherwise, this non-OSGi type daily record be described
Log services corresponding to factory unregistered;
In the case of the described log services corresponding in the factory of described non-OSGi type daily record is unregistered, by described log services
Be registered as OSGi type log services and include judging whether log services corresponding to the factory of described non-OSGi type daily record exists
In public service platform OSGi, the log services corresponding when the factory of described non-OSGi type daily record is present in public service
Time in platform OSGi, described log services is registered as OSGi type log services;Factory when described non-OSGi type daily record
When corresponding log services is not present in public service platform OSGi, the factory adding described non-OSGi type daily record is corresponding
Log services, wherein, according to log services interface when adding log services corresponding to the factory of described non-OSGi type daily record
LogService adds the log services corresponding to factory of described non-OSGi type daily record;
The described log services corresponding according to the factory of the log services interface LogService described non-OSGi type daily record of interpolation
Detailed process be: log services interface realize LogServiceImpl by log services interface LogService definition
Log () method, log information message when will call this log services, daily record rank level, that this log services is quoted is right
As the message Throwable exception of ServiceRefence and band exception is encapsulated as a journal entries.
Method the most according to claim 1, it is characterised in that also include:
Deriving the interface of log services corresponding to the factory of described non-OSGi type daily record, described interface carries version number.
Method the most according to claim 1, it is characterised in that also include:
After the log services registration that the factory of described non-OSGi type daily record is corresponding, exporting described non-OSGi type daily record
During the log information of the log services record that factory is corresponding, daily record audiomonitor interface LogListener sends journal entries interface
The journal entries of LogEntry type, to daily record service interface LogService, obtains LogEntry pair, described journal entries interface
As corresponding log information;
Described method also includes: after the log services registration that the factory of described non-OSGi type daily record is corresponding, with pure service
Mode or by embedding in the way of load described log services.
4. a log services processing means, it is characterised in that including:
Transfer unit, after starting at assembly, transmits the context object of described assembly to not common service platform OSGi class
The factory of type daily record;
Memory element, the work of context object to described non-OSGi type daily record for preserving the assembly of transfer unit transmission
Factory;
First judging unit, for judging that log services corresponding to the factory of described non-OSGi type daily record is the most registered be
OSGi type log services;
Return unit, for the daily record corresponding in the factory that judged result is described non-OSGi type daily record of the first judging unit
Service registered in the case of, return described OSGi type log services;
First registering unit, corresponding for the factory that judged result is described non-OSGi type daily record at the first judging unit
In the case of log services is unregistered, described log services is registered as OSGi type log services;
Wherein, described first judging unit is for judging described non-according to log read service interface LogReaderService
The log services that the factory of OSGi type daily record is corresponding is the most registered for OSGi type log services;
The described factory's correspondence judging described non-OSGi type daily record according to log read service interface LogReaderService
The most registered process for OSGi type log services of log services be: according to log read service interface
The service of the service corresponding for name lookup log read service interface LogReaderService of LogReaderService is drawn
Use object;When judging this service object not as sky, the context object preserved from the factory of non-OSGi type daily record obtains
Take the object of log read service interface LogReaderService type;Usage log reads service interface
The object of getlog () the retrieval log read service interface LogReaderService type of LogReaderService definition
Corresponding journal entries, if include the daily record clothes that the factory of this non-OSGi type daily record is corresponding in the journal entries retrieved
Business, then illustrate that log services corresponding to the factory of this non-OSGi type daily record is registered, otherwise, this non-OSGi type daily record be described
Log services corresponding to factory unregistered;
In the case of the log services that the factory of described non-OSGi type daily record is corresponding is unregistered, described log services is registered
Include judging whether log services corresponding to the factory of described non-OSGi type daily record is present in public affairs for OSGi type log services
Altogether in service platform OSGi, the log services corresponding when the factory of described non-OSGi type daily record is present in public service platform
Time in OSGi, described log services is registered as OSGi type log services;When the factory of described non-OSGi type daily record is corresponding
Log services when being not present in public service platform OSGi, add the daily record that the factory of described non-OSGi type daily record is corresponding
Service, wherein, according to log services interface when adding log services corresponding to the factory of described non-OSGi type daily record
LogService adds the log services corresponding to factory of described non-OSGi type daily record;
The described log services corresponding according to the factory of the log services interface LogService described non-OSGi type daily record of interpolation
Detailed process be: log services interface realize LogServiceImpl by log services interface LogService definition
Log () method, log information message when will call this log services, daily record rank level, that this log services is quoted is right
As the message Throwable exception of ServiceRefence and band exception is encapsulated as a journal entries.
Device the most according to claim 4, it is characterised in that the first registering unit includes: the second judging unit, interpolation list
Unit and the second registering unit;
Wherein, the second judging unit, for judging whether log services corresponding to the factory of described non-OSGi type daily record exists
In public service platform OSGi;
Adding device, for the log services corresponding in the factory that judged result is non-OSGi type daily record of the second judging unit
In the case of not existing in public service platform OSGi, add the daily record clothes that the factory of described non-OSGi type daily record is corresponding
Business;
Second registering unit, for registering the log services that the factory of the non-OSGi type daily record that described adding device adds is corresponding
Or for being present in public in the log services that the factory that judged result is non-OSGi type daily record of the second judging unit is corresponding
In the case of in service platform OSGi, register the log services that the factory of described non-OSGi type daily record is corresponding.
Device the most according to claim 4, it is characterised in that also include:
Lead-out unit, for deriving the interface of log services corresponding to the factory of described non-OSGi type daily record, described derivation list
The interface of first log services corresponding specifically for the factory deriving the described non-OSGi type daily record carrying version number.
Device the most according to claim 4, it is characterised in that also include:
Processing unit, after the log services registration that the factory in described non-OSGi type daily record is corresponding, described non-in output
During the log information of the log services record that the factory of OSGi type daily record is corresponding, daily record audiomonitor interface LogListener sends out
Send the journal entries of journal entries interface LogEntry type to daily record service interface LogService, obtain described journal entries
The log information that interface LogEntry object is corresponding;
Described device, also includes:
Loading unit, after the log services registration that the factory in described non-OSGi type daily record is corresponding, with the side of pure service
Formula or by embedding in the way of load described log services.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210583988.XA CN103095491B (en) | 2012-12-30 | 2012-12-30 | A kind of log services processing method and processing device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210583988.XA CN103095491B (en) | 2012-12-30 | 2012-12-30 | A kind of log services processing method and processing device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103095491A CN103095491A (en) | 2013-05-08 |
CN103095491B true CN103095491B (en) | 2016-08-24 |
Family
ID=48207651
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210583988.XA Active CN103095491B (en) | 2012-12-30 | 2012-12-30 | A kind of log services processing method and processing device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103095491B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104978256A (en) * | 2014-04-10 | 2015-10-14 | 阿里巴巴集团控股有限公司 | Log output method and equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1542404A1 (en) * | 2003-12-08 | 2005-06-15 | Samsung Electronics Co., Ltd. | Sharing services on a network |
CN101425034A (en) * | 2008-08-11 | 2009-05-06 | 深圳市金蝶中间件有限公司 | Log recording method and log system |
CN102158490A (en) * | 2011-04-07 | 2011-08-17 | 山东中创软件商用中间件股份有限公司 | Service switching method based on OSGi and device thereof |
CN102333019A (en) * | 2011-09-02 | 2012-01-25 | 东莞中山大学研究院 | Proxy device for being compatible to logical device access |
-
2012
- 2012-12-30 CN CN201210583988.XA patent/CN103095491B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1542404A1 (en) * | 2003-12-08 | 2005-06-15 | Samsung Electronics Co., Ltd. | Sharing services on a network |
CN101425034A (en) * | 2008-08-11 | 2009-05-06 | 深圳市金蝶中间件有限公司 | Log recording method and log system |
CN102158490A (en) * | 2011-04-07 | 2011-08-17 | 山东中创软件商用中间件股份有限公司 | Service switching method based on OSGi and device thereof |
CN102333019A (en) * | 2011-09-02 | 2012-01-25 | 东莞中山大学研究院 | Proxy device for being compatible to logical device access |
Also Published As
Publication number | Publication date |
---|---|
CN103095491A (en) | 2013-05-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110297641B (en) | Application arrangement and deployment method based on kubernets | |
CN102647430A (en) | Real-name certification system and method capable of hiding identity information | |
CN104519108B (en) | Push accounts information, the method for importing relation chain, apparatus and system | |
CN110430235B (en) | Method, apparatus, storage medium and computing device for cross-chain transmission of authenticatable messages | |
CN103688513B (en) | Content sharing method and Social Synchronizing Apparatus | |
CN107484155A (en) | A kind of method for network access, a kind of electronic equipment and a kind of mobile terminal | |
CN105323229A (en) | CPE-based data transmission method, network element, platform and system | |
CN102457409A (en) | Method and system for link failure detection | |
CN104936157A (en) | Mobile phone number bound account acquisition method and system | |
CN104348848A (en) | Method, terminal equipment and server for managing pictures | |
CN105721659B (en) | Incoming call processing method and device | |
CN104301490A (en) | Method for associating communication object with record and smart mobile terminal | |
CN107948052A (en) | Information crawler method, apparatus, electronic equipment and system | |
CN104836800A (en) | Service quality control method, equipment and service quality control system | |
CN103795445A (en) | Method and system for transferring address book information based on blue tooth | |
CN104503768A (en) | Call method and device for application programming interface (API) | |
CN103095491B (en) | A kind of log services processing method and processing device | |
CN106792600A (en) | A kind of information processing method, mobile terminal, netscape messaging server Netscape | |
CN106878455A (en) | A kind of acquisition methods and server of the information on services based on internet | |
CN101489203A (en) | Call forwarding method, apparatus and system | |
CN105635497A (en) | Terminal call transfer method and call transfer terminal | |
CN101594592B (en) | Method and device for sending messages based on different software platforms | |
WO2008104039A8 (en) | Method of transferring data being stored in a database | |
CN110022332B (en) | Hypertext transfer security protocol proxy method, device, equipment and medium | |
CN101860451A (en) | Method and device for household gateway management business |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |