freshlu11 opened a new issue, #23796:
URL: https://github.com/apache/airflow/issues/23796

   ### Apache Airflow version
   
   2.3.0 (latest released)
   
   ### What happened
   
   same as #19401 , when I open task`s log in web interface, it shifts this 
time forward by 8 hours (for Asia/Shanghai), but it's already in Asia/Shanghai.
   here is the log in web:
   ```
   *** Reading local file: 
/opt/airflow/logs/forecast/cal/2022-05-18T09:50:00+00:00/1.log
   [2022-05-19, 13:54:52] {taskinstance.py:1037} INFO ...
   ```
   
   As you seee, UTC time is 2022-05-18T09:50:00,and My timezone is 
Asia/Shanghai(should shift forward 8 hours),but it shift forward 16hours!
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   _No response_
   
   ### Operating System
   
   Debian GNU/Linux 11 (bullseye)(docker)
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   1. build my docker image from apache/airflow:2.3.0 to change timezone
   ```Dockerfile
   FROM apache/airflow:2.3.0
   # bugfix of log UI in web, here I change ti_log.js file by following on 
#19401 
   COPY ./ti_log.js 
/home/airflow/.local/lib/python3.7/site-packages/airflow/www/static/js/ti_log.js
   USER root
   # container timezone changed to CST time
   RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
     && rm -rf /etc/timezone \
     && echo Asia/Shanghai >> /etc/timezone \
     && chown airflow 
/home/airflow/.local/lib/python3.7/site-packages/airflow/www/static/js/ti_log.js
   USER airflow
   ```
   2. use my image to run airflow by docker-compose
   
   3. check task logs in web
   Although I have changed the file `airflow/www/static/js/ti_log.js`, but it 
did not work! Then check source from Web, I found another file : 
`airflow/www/static/dist/tiLog.e915520196109d459cf8.js`, then I replace 
"+00:00" by  "+08:00" in this file. Finally it works!
   
   ```js
   # origin tiLog.e915520196109d459cf8.js
   replaceAll(c,(e=>`<time datetime="${e}+00:00" 
data-with-tz="true">${Object(a.f)(`${e}+00:00`)}</time>`))
   ```
   
   ```js
   # what I changed
   replaceAll(c,(e=>`<time datetime="${e}+08:00" 
data-with-tz="true">${Object(a.f)(`${e}+08:00`)}</time>`))
   ```
   
   
   
   
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to