Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get the user system in my application logs

user-s38y1Jul 27 2023 — edited Jul 27 2023

Hi I'm new to Oracle adf and i'm using this version Oracle IDE 12.2.1.3.42.170820.0914.

I am currently working on an Oracle ADF application.

I want to get the users system name when user logged into Adf application and i want to print that system name in my adf application server logs. I have added below line in one of my method to get the users system name.

  try {  
   String computerName = InetAddress.getLocalHost().getHostName();  
   
   logger.warning(String.format("JUTI - " + LOGIN\_SUCCESSFUL + " : " + userInfo.getFullnameWithComma() +  
                                " User machineId: " + computerName));  
 }

 catch (Exception ex) {  
   String userName = ADFUtils.getADFContext().getSecurityContext().getUserName();  
   logger.severe("JUTI - Unable to retrive the machineId: " + ex + " for user: " + userName);  
 }

I'm getting the system name when i deploy the code locally. But when i the deploy the code into non-production environment it is printing the server hostname instead of user's system.

Can anyone help me here to sort out this issue.

Thanks in Advance

Comments
Post Details
Added on Jul 27 2023
7 comments
265 views