[ 
https://issues.apache.org/jira/browse/HDDS-5803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17640018#comment-17640018
 ] 

Zita Dombi commented on HDDS-5803:
----------------------------------

so in the past week I was looking into this improvement and how could we make 
it happen. first I would like to describe how it is working currently. in Ozone 
we have two options to define the log directory: the {{OZONE_LOG_DIR}} 
environment variable or the {{hadoop.log.dir}} JVM argument. the precedence is 
that at first we check if the {{hadoop.log.dir}} was already set in the 
{{{}OZONE_OPTS{}}}; if yes, we will use that and won't change anything. if it 
wasn't there previously, we add the {{hadoop.log.dir}} flag with the 
{{OZONE_LOG_DIR}} environment variable as a value. 
[this|https://github.com/apache/ozone/blob/master/hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh#L1536]
 is the part we do this:
{code:java}
ozone_add_param OZONE_OPTS hadoop.log.dir "-Dhadoop.log.dir=${OZONE_LOG_DIR}"
{code}
and the method we use is 
[this|https://github.com/apache/ozone/blob/master/hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh#L1119]:
{code:java}
## @description  Append the `appendstring` if `checkstring` is not
## @description  present in the given `envvar`
## @audience     public
## @stability    stable
## @replaceable  yes
## @param        envvar
## @param        checkstring
## @param        appendstring
function ozone_add_param
{code}
the {{OZONE_LOG_DIR}} is set inside the 
[ozone_basic_init|https://github.com/apache/ozone/blob/master/hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh#L860]
 method. in this we are also handling the deprecated {{HADOOP_LOG_DIR}} 
variable, if the {{OZONE_LOG_DIR}} was undefined, we set it based on that (if 
none of them is set we use default {{{}${OZONE_HOME}/logs{}}}). you can check 
that logic 
[here|https://github.com/apache/ozone/blob/master/hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh#L2807L2884].

in the code we use the {{hadoop.log.dir}} property several times (eg. 
{{{}System.getProperty("hadoop.log.dir"){}}}), just like the other properties 
we set in the 
[ozone_finalize_opts|https://github.com/apache/ozone/blob/master/hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh#L1533].

so to summarise this: if we would like to use the {{ozone.log.dir}} as a 
property we would need to handle the {{hadoop.log.dir}} as well for 
compatibility reasons. there are many questions around this:
 * do we want to keep the {{ozone.log.dir}} or the {{hadoop.log.dir}} property?
 * if we want to keep the {{{}ozone.log.dir{}}}, should we rename all the 
occurrences in the code based on that? and if the {{hadoop.log.dir}} was set 
previously we should use that as a fallback?
 * if we keep both, that could be misleading

the order should be: {{{}ozone.log.dir{}}}, {{{}hadoop.log.dir{}}}, 
{{OZONE_LOG_DIR}}? so we should check if the {{ozone.log.dir}} was set, if yes 
use that (and rename the code occurrences?), if it wasn't set we should use the 
{{{}hadoop.log.dir{}}}, so we should check if that property was there and 
remove it and add the value with the {{ozone.log.dir}} property. If none of 
them was there we should use the {{OZONE_LOG_DIR}} as the value for the 
{{ozone.log.dir}} property. and all of this should be done with the other opts 
I think.

this is definitely a bigger thing than it was expected and it requires 
refactoring and more changes. we should also add testing for this, as this 
could cause issues with compatibility. I am not sure if this worths it to be 
done, as we have the {{hadoop.log.dir}} property as another option beside the 
{{OZONE_LOG_DIR}} env variable. let me know what you think cc [~nanda] [~smeng]

thanks for the offline help [~adoroszlai] :) feel free to add anything I may 
have missed

> Support "ozone.log.dir" property for configuring log location
> -------------------------------------------------------------
>
>                 Key: HDDS-5803
>                 URL: https://issues.apache.org/jira/browse/HDDS-5803
>             Project: Apache Ozone
>          Issue Type: Improvement
>            Reporter: Nandakumar
>            Assignee: Zita Dombi
>            Priority: Major
>
> Currently, we only support OZONE_LOG_DIR environmental variable for setting 
> the log directory for Ozone.
> This jira is for adding "ozone.log.dir" JVM argument in addition to 
> OZONE_LOG_DIR environmental variable for setting the log directory for Ozone.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to