BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jklaverstijn
Rhodochrosite | Level 12

Hi,

 

I was wondering how to use environment variable values in log4sas. Our use case: place the workspace server logs for different user groups. A user is member of just one, indicated by environment variable TENANT. If I look at the comparable log4j facility there is a possibility to refer to this by ${env.TENANT}. I was hoping for something similar in log4sas like

 

%S{env.TENANT}

But unfortunately it is not provided.

 

Am I overlooking something? Is there another way to accomplish the same (short of specifying a separate logconfig.xml for each user group)? Would, if needed, a feature request garner your support?

 

Kind regards,

- Jan.

1 ACCEPTED SOLUTION

Accepted Solutions
PaulHomes
Rhodochrosite | Level 12

Hi Jan,

 

I see that documentation for SAS ESP 4.3/5.1 and SAS DataFlux Data Management Server 2.6 have examples of the form %S{OSENV.env_var_name} in their logging XML - e.g. https://support.sas.com/kb/60/591.html

 

There's another example of it at https://communities.sas.com/t5/SAS-Communities-Library/The-Node-Less-Traveled-Improving-Job-Performa...

 

 

I note that OSENV isn't documented as a key for the S Conversion Character in the SAS 9.4 Logging: Configuration and Programming Reference but it'd be worth a try - you never know 🙂

 

 

Cheers

Paul

View solution in original post

5 REPLIES 5
jklaverstijn
Rhodochrosite | Level 12

Unfortunately not in the logconfig.xml, Kurt. This is not SAS code but XML configuration. Sorry for not being more clearly about this.

 

PaulHomes
Rhodochrosite | Level 12

Hi Jan,

 

I see that documentation for SAS ESP 4.3/5.1 and SAS DataFlux Data Management Server 2.6 have examples of the form %S{OSENV.env_var_name} in their logging XML - e.g. https://support.sas.com/kb/60/591.html

 

There's another example of it at https://communities.sas.com/t5/SAS-Communities-Library/The-Node-Less-Traveled-Improving-Job-Performa...

 

 

I note that OSENV isn't documented as a key for the S Conversion Character in the SAS 9.4 Logging: Configuration and Programming Reference but it'd be worth a try - you never know 🙂

 

 

Cheers

Paul

PaulHomes
Rhodochrosite | Level 12

I was curious so I tried it out with the RollingFileAppender FileNamePattern value in a SAS 9.4 M5 Workspace Server logconfig.xml and it seems to work (even though it is not documented). Probably best to ask SAS tech support if it is supported and what SAS versions it works with.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1251 views
  • 6 likes
  • 3 in conversation