Hi Gayan,

I think the best way is to do it from the logstash level if
possible (filtering etc .. )

If you really need the product name in each log line, you can simply modify
the log appender in log4j.porperties.

log4j.appender.CARBON_LOGFILE.File=${carbon.home}/repository/logs/${instance.log}/wso2carbon${instance.log}.log
log4j.appender.CARBON_LOGFILE.Append=true
log4j.appender.CARBON_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
# ConversionPattern will be overridden by the configuration setting in the
DB
log4j.appender.CARBON_LOGFILE.layout.ConversionPattern=*[WSO2-IS]* TID:
[%T] [%S] [%d] %P%5p {%c} - %x %m %n




On Tue, Aug 7, 2018 at 6:44 PM gayan gunawardana <[email protected]>
wrote:

> Thanks All,
>
> I need something like below to print product name with each line of log so
> that It would be easy to separate logs by product in logstash.
>
> TID: [-1] [ESB] [2018-07-12 15:38:22,463] DEBUG
> {org.wso2.carbon.mediation.ntask.internal.NtaskService} -  Un-setting the
> Realm Service. {org.wso2.carbon.mediation.ntask.internal.NtaskService}
>
> On Mon, Aug 6, 2018 at 9:18 PM, Godwin Shrimal <[email protected]> wrote:
>
>>
>>
>> On Mon, Aug 6, 2018 at 4:42 PM Prakhash Sivakumar <[email protected]>
>> wrote:
>>
>>>
>>> On Mon, Aug 6, 2018 at 9:02 PM Godwin Shrimal <[email protected]> wrote:
>>>
>>>>
>>>>
>>>> On Mon, Aug 6, 2018 at 2:22 PM Prakhash Sivakumar <[email protected]>
>>>> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Mon, Aug 6, 2018 at 2:19 PM Godwin Shrimal <[email protected]> wrote:
>>>>>
>>>>>> I don't see any value in printing product name for every logline. We
>>>>>> already printing product name once server started. Please see the example
>>>>>> below.
>>>>>>
>>>>>> [2018-08-06 09:48:08,391]  INFO
>>>>>> {org.wso2.carbon.core.internal.StartupFinalizerServiceComponent} -
>>>>>> Server           :  WSO2 Identity Server-5.1.0
>>>>>>
>>>>>
>>>>> I think there might be situations like identifying log files when we
>>>>> are doing the log file rotation, as those log files won't be having the
>>>>> startup logs, it might be difficult to identify the files if we are not
>>>>> properly handling it.
>>>>>
>>>>> In that case I think printing product names in the new log file when
>>>>> starting the log file rotation would help.
>>>>>
>>>>
>>>> I am not clear how printing productname in each line help for log
>>>> rotation. Can you explain using an example ?
>>>>
>>> What I was suggesting is printing the product name when creating a new
>>> file every time during the rotation. It will appear only once in the log
>>> file.(not in each line)
>>>
>>
>> Ok, I understand wht you are telling now, once log rotated, we cannot
>> have any log entry identify product name.
>>
>>>
>>> I think Gayan's requirement also should be something similar. @Gayan can
>>> you please elaborate if you have any other requirements
>>>
>> Yes. Can you explain what you are trying to acheive here ?
>>
>> Thanks
>> Godwin
>>
>>
>>
>>>
>>> Thanks.
>>>
>>>>
>>>> Thanks
>>>> Godwin
>>>>
>>>>
>>>>
>>>>>
>>>>>>
>>>>>> Thanks
>>>>>> Godwin
>>>>>>
>>>>>> On Mon, Aug 6, 2018 at 5:50 AM Rushmin Fernando <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Gayan,
>>>>>>>
>>>>>>> What's the requirement behind this? And are you expecting a one time
>>>>>>> log or the product name for every logline?
>>>>>>>
>>>>>>> On Mon, Aug 6, 2018 at 12:43 PM gayan gunawardana <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Hi Devs,
>>>>>>>>
>>>>>>>> Appreciate your input regarding $subject.
>>>>>>>>
>>>>>>>> --
>>>>>>>> Gayan
>>>>>>>> _______________________________________________
>>>>>>>> Dev mailing list
>>>>>>>> [email protected]
>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> *Best Regards*
>>>>>>>
>>>>>>> *Rushmin Fernando*
>>>>>>> *Technical Lead*
>>>>>>>
>>>>>>> WSO2 Inc. <http://wso2.com/> - Lean . Enterprise . Middleware
>>>>>>>
>>>>>>> mobile : +94775615183
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Dev mailing list
>>>>>>> [email protected]
>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Godwin Amila Shrimal*
>>>>>> Associate Technical Lead
>>>>>> WSO2 Inc.; http://wso2.com
>>>>>> lean.enterprise.middleware
>>>>>>
>>>>>> mobile: *+94772264165*
>>>>>> linkedin: *https://www.linkedin.com/in/godwin-amila-2ba26844/
>>>>>> <https://www.linkedin.com/in/godwin-amila-2ba26844/>*
>>>>>> twitter: https://twitter.com/godwinamila
>>>>>> <http://wso2.com/signature>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> [email protected]
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Prakhash Sivakumar
>>>>> Senior Software Engineer | WSO2 Inc
>>>>> Platform Security Team
>>>>> Mobile : +94771510080
>>>>> Blog : https://medium.com/@PrakhashS
>>>>>
>>>>
>>>>
>>>> --
>>>> *Godwin Amila Shrimal*
>>>> Associate Technical Lead
>>>> WSO2 Inc.; http://wso2.com
>>>> lean.enterprise.middleware
>>>>
>>>> mobile: *+94772264165*
>>>> linkedin: *https://www.linkedin.com/in/godwin-amila-2ba26844/
>>>> <https://www.linkedin.com/in/godwin-amila-2ba26844/>*
>>>> twitter: https://twitter.com/godwinamila
>>>> <http://wso2.com/signature>
>>>>
>>>
>>>
>>> --
>>> Prakhash Sivakumar
>>> Senior Software Engineer | WSO2 Inc
>>> Platform Security Team
>>> Mobile : +94771510080
>>> Blog : https://medium.com/@PrakhashS
>>>
>>
>>
>> --
>> *Godwin Amila Shrimal*
>> Associate Technical Lead
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94772264165*
>> linkedin: *https://www.linkedin.com/in/godwin-amila-2ba26844/
>> <https://www.linkedin.com/in/godwin-amila-2ba26844/>*
>> twitter: https://twitter.com/godwinamila
>> <http://wso2.com/signature>
>>
>
>
>
> --
> Gayan
>


-- 
*Best Regards*

*Rushmin Fernando*
*Technical Lead*

WSO2 Inc. <http://wso2.com/> - Lean . Enterprise . Middleware

mobile : +94775615183
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to