<!doctype html>
<!--
  Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
  Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
  Free for personal and commercial use under the MIT license
  https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
-->
<html lang="en" class="no-js">
  <head>
    <meta charset="utf-8">

<!-- begin _includes/seo.html --><title>Why Hibernate Still Logs SQL Even When Disabled in application.yaml - Highly Distinguish</title>
<meta name="description" content="Good leadership consists of doing less and being more.  —Dave Ramsey">



<meta property="og:type" content="article">
<meta property="og:locale" content="en_US">
<meta property="og:site_name" content="Highly Distinguish">
<meta property="og:title" content="Why Hibernate Still Logs SQL Even When Disabled in application.yaml">
<meta property="og:url" content="http://todzhang.com/blogs/tech/en/Why_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml">


  <meta property="og:description" content="Good leadership consists of doing less and being more.  —Dave Ramsey">



  <meta property="og:image" content="http://todzhang.com/assets/images/2024/04/04/header.jpg">





  <meta property="article:published_time" content="2024-05-01T00:00:00+00:00">






<link rel="canonical" href="http://todzhang.com/blogs/tech/en/Why_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml">




<script type="application/ld+json">
  {
    "@context": "https://schema.org",
    
      "@type": "Person",
      "name": null,
      "url": "http://todzhang.com/"
    
  }
</script>







<!-- end _includes/seo.html -->



  <link href="/feed.xml" type="application/atom+xml" rel="alternate" title="Highly Distinguish Feed">


<!-- https://t.co/dKP3o1e -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script>
  document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js ';
</script>

<!-- For all browsers -->
<link rel="stylesheet" href="/assets/css/main.css">
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css"></noscript>



    <!-- start custom head snippets -->

<!-- 现代化meta标签 -->
<meta name="theme-color" content="#6366f1">
<meta name="msapplication-TileColor" content="#6366f1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">

<!-- 现代化字体预加载 -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

<!-- 现代化图标 -->
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🚀</text></svg>">

<!-- 现代化CSS变量和主题切换 -->
<style>
  /* 主题切换按钮 */
  .theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }
  
  .theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  }
  
  /* 深色模式 */
  [data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
  }
  
  [data-theme="dark"] .page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }
  
  [data-theme="dark"] .masthead {
    background: rgba(15, 23, 42, 0.95);
  }
  
  [data-theme="dark"] .archive__item {
    background: rgba(30, 41, 59, 0.9);
    color: #f1f5f9;
  }
  
  [data-theme="dark"] .archive__item-title a {
    color: #f1f5f9;
  }
  
  [data-theme="dark"] .sidebar {
    background: rgba(30, 41, 59, 0.9);
    color: #f1f5f9;
  }
  
  /* 平滑过渡 */
  * {
    transition: background-color 0.3s ease, color 0.3s ease;
  }
  
  /* 现代化加载动画 */
  .loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-top: 3px solid #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
  }
  
  /* 现代化滚动指示器 */
  .scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    z-index: 1002;
    transition: width 0.3s ease;
  }
</style>

<!-- insert favicons. use https://realfavicongenerator.net/ -->

<!-- end custom head snippets -->

    <!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Why Hibernate Still Logs SQL Even When Disabled in application.yaml | Highly Distinguish</title>
<meta name="generator" content="Jekyll v3.10.0" />
<meta property="og:title" content="Why Hibernate Still Logs SQL Even When Disabled in application.yaml" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Good leadership consists of doing less and being more. —Dave Ramsey" />
<meta property="og:description" content="Good leadership consists of doing less and being more. —Dave Ramsey" />
<link rel="canonical" href="http://todzhang.com/blogs/tech/en/Why_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml" />
<meta property="og:url" content="http://todzhang.com/blogs/tech/en/Why_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml" />
<meta property="og:site_name" content="Highly Distinguish" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2024-05-01T00:00:00+00:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Why Hibernate Still Logs SQL Even When Disabled in application.yaml" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2024-05-01T00:00:00+00:00","datePublished":"2024-05-01T00:00:00+00:00","description":"Good leadership consists of doing less and being more. —Dave Ramsey","headline":"Why Hibernate Still Logs SQL Even When Disabled in application.yaml","mainEntityOfPage":{"@type":"WebPage","@id":"http://todzhang.com/blogs/tech/en/Why_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml"},"url":"http://todzhang.com/blogs/tech/en/Why_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml"}</script>
<!-- End Jekyll SEO tag -->

  </head>

  <body class="layout--single">
    <nav class="skip-links">
  <ul>
    <li><a href="#site-nav" class="screen-reader-shortcut">Skip to primary navigation</a></li>
    <li><a href="#main" class="screen-reader-shortcut">Skip to content</a></li>
    <li><a href="#footer" class="screen-reader-shortcut">Skip to footer</a></li>
  </ul>
</nav>

    <!--[if lt IE 9]>
<div class="notice--danger align-center" style="margin: 0;">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience.</div>
<![endif]-->

    

<div class="masthead">
  <div class="masthead__inner-wrap">
    <div class="masthead__menu">
      <nav id="site-nav" class="greedy-nav">
        
        <a class="site-title" href="/">
          Highly Distinguish
          <span class="site-subtitle">IT solution & education</span>
        </a>
        <ul class="visible-links"><li class="masthead__menu-item">
              <a href="/about/">About</a>
            </li><li class="masthead__menu-item">
              <a href="/tags/">Tags</a>
            </li><li class="masthead__menu-item">
              <a href="/sitemap/">Sitemap</a>
            </li></ul>
        
        <button class="search__toggle" type="button">
          <span class="visually-hidden">Toggle search</span>
          <i class="fas fa-search"></i>
        </button>
        
        <button class="greedy-nav__toggle hidden" type="button">
          <span class="visually-hidden">Toggle menu</span>
          <div class="navicon"></div>
        </button>
        <ul class="hidden-links hidden"></ul>
      </nav>
    </div>
  </div>
</div>


    <div class="initial-content">
      
  







<div class="page__hero"
  style=" background-image: url('');"
>
  
    <img src="/assets/images/2024/04/04/header.jpg" alt="Why Hibernate Still Logs SQL Even When Disabled in application.yaml" class="page__hero-image">
  
  
</div>





<div id="main" role="main">
  
  <div class="sidebar sticky">
  


<div itemscope itemtype="https://schema.org/Person" class="h-card">

  

  <div class="author__content">
    <h3 class="author__name p-name" itemprop="name">
      <a class="u-url" rel="me" href="http://todzhang.com/" itemprop="url"></a>
    </h3>
    
  </div>

  <div class="author__urls-wrapper">
    <button class="btn btn--inverse">Follow</button>
    <ul class="author__urls social-icons">
      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      <!--
  <li>
    <a href="http://link-to-whatever-social-network.com/user/" itemprop="sameAs" rel="nofollow noopener noreferrer me">
      <i class="fas fa-fw" aria-hidden="true"></i> Custom Social Profile Link
    </a>
  </li>
-->
    </ul>
  </div>
</div>
  
  </div>



  <article class="page h-entry" itemscope itemtype="https://schema.org/CreativeWork">
    <meta itemprop="headline" content="Why Hibernate Still Logs SQL Even When Disabled in application.yaml">
    <meta itemprop="description" content="  Good leadership consists of doing less and being more.  —Dave Ramsey">
    <meta itemprop="datePublished" content="2024-05-01T00:00:00+00:00">
    

    <div class="page__inner-wrap">
      
        <header>
          <h1 id="page-title" class="page__title p-name" itemprop="headline">
            <a href="http://todzhang.com/blogs/tech/en/Why_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml" class="u-url" itemprop="url">Why Hibernate Still Logs SQL Even When Disabled in application.yaml
</a>
          </h1>
          

  <p class="page__meta">
    

    

    
      
      

      <span class="page__meta-readtime">
        <i class="far fa-clock" aria-hidden="true"></i>
        
          1 minute read
        
      </span>
    
  </p>


        </header>
      

      <section class="page__content e-content" itemprop="text">
        
          <aside class="sidebar__right sticky">
            <nav class="toc">
              <header><h4 class="nav__title"><i class="fas fa-file-alt"></i> On this page</h4></header>
              <ul class="toc__menu"><li><a href="#the-problem">The Problem</a></li><li><a href="#investigation">Investigation</a><ul><li><a href="#code-review-the-investigation-delved-into-the-source-code-of-hibernate-hibernate-core-5610final-specifically">Code Review: The investigation delved into the source code of Hibernate (hibernate-core-5.6.10.Final), specifically:</a></li><li><a href="#property-setting-flow-the-code-revealed-the-following-flow-for-setting-hibernate-properties">Property Setting Flow: The code revealed the following flow for setting Hibernate properties:</a></li></ul></li><li><a href="#the-culprit">The Culprit</a></li><li><a href="#fixing-the-issue">Fixing the Issue</a></li><li><a href="#tips-for-future-troubleshooting">Tips for Future Troubleshooting</a></li></ul>

            </nav>
          </aside>
        
        <blockquote>
  <p>Good leadership consists of doing less and being more.  —Dave Ramsey</p>
</blockquote>

<p>This blog post explores a troubleshooting scenario where Hibernate continued to output SQL statements in logs even after disabling it in the application.yaml file. It serves as a guide for your team to understand property setting logic in Spring Boot and Hibernate.</p>

<h1 id="the-problem">The Problem</h1>
<p>The issue arose when SQL queries persisted in the logs despite setting <code class="language-plaintext highlighter-rouge">hibernate.show_sql</code> to <code class="language-plaintext highlighter-rouge">false</code> in <code class="language-plaintext highlighter-rouge">application.yaml</code>.</p>

<h1 id="investigation">Investigation</h1>
<h2 id="code-review-the-investigation-delved-into-the-source-code-of-hibernate-hibernate-core-5610final-specifically">Code Review: The investigation delved into the source code of Hibernate (<code class="language-plaintext highlighter-rouge">hibernate-core-5.6.10.Final</code>), specifically:</h2>

<ul>
  <li><code class="language-plaintext highlighter-rouge">SqlStatementLogger.java</code>: This class defines the <code class="language-plaintext highlighter-rouge">logStatement</code> method responsible for logging SQL statements.</li>
  <li><code class="language-plaintext highlighter-rouge">JdbcServicesImpl.java</code>: This class configures the <code class="language-plaintext highlighter-rouge">SqlStatementLogger</code> based on properties like showSQL.  - <img src="/assets/images/2024/05/01/image.png" alt="img.png" /></li>
  <li><code class="language-plaintext highlighter-rouge">StandardServiceRegistryImpl.java</code>: This class accepts a <code class="language-plaintext highlighter-rouge">configurationValues</code> map containing Hibernate properties.
    <h2 id="property-setting-flow-the-code-revealed-the-following-flow-for-setting-hibernate-properties">Property Setting Flow: The code revealed the following flow for setting Hibernate properties:</h2>
  </li>
  <li><code class="language-plaintext highlighter-rouge">StandardServiceRegistryBuilder</code> is created with <code class="language-plaintext highlighter-rouge">configurationValues</code>.</li>
  <li>This builder applies the settings to the internal registry.</li>
  <li><code class="language-plaintext highlighter-rouge">EntityManagerFactoryBuilderImpl</code> uses this registry during building.</li>
  <li>Ultimately, the properties are set from 1 in your project.
    <h1 id="the-culprit">The Culprit</h1>
    <p>The investigation identified <code class="language-plaintext highlighter-rouge">MasterJpaConfiguration.java</code> as the source of the issue. It explicitly set <code class="language-plaintext highlighter-rouge">hibernate.show_sql</code> to <code class="language-plaintext highlighter-rouge">true</code>, overriding any potential <code class="language-plaintext highlighter-rouge">false</code> setting from <code class="language-plaintext highlighter-rouge">application.yaml</code>.</p>
  </li>
</ul>

<h1 id="fixing-the-issue">Fixing the Issue</h1>
<p>To resolve the problem, you can:</p>

<ul>
  <li>Remove the <code class="language-plaintext highlighter-rouge">hibernate.show_sql</code> property from <code class="language-plaintext highlighter-rouge">MasterJpaConfiguration.java</code>.</li>
  <li>Set <code class="language-plaintext highlighter-rouge">hibernate.show_sql</code> to <code class="language-plaintext highlighter-rouge">false</code> in<code class="language-plaintext highlighter-rouge"> application.yaml</code> if intended for global configuration.
    <h1 id="tips-for-future-troubleshooting">Tips for Future Troubleshooting</h1>
    <p>When encountering unexpected behavior related to Hibernate properties:</p>
  </li>
  <li>Search your project for keywords like <code class="language-plaintext highlighter-rouge">hibernate.show_sql</code> or use wildcards like <code class="language-plaintext highlighter-rouge">hibernate.show_sql*</code>.</li>
  <li><img src="/assets/images/2024/05/01/image-2.png" alt="img.png" /></li>
  <li>Remember that properties set in Java code (like <code class="language-plaintext highlighter-rouge">MasterJpaConfiguration.java</code>) might override those from configuration files (like <code class="language-plaintext highlighter-rouge">application.yaml</code>).
This blog post demonstrates a structured approach to troubleshooting Hibernate property settings in Spring Boot applications. 
By understanding the property flow and using proper search techniques, your team can effectively resolve similar issues in the future.</li>
</ul>

<p>–HTH–</p>

        
      </section>

      <footer class="page__meta">
        
        


        

  <p class="page__date"><strong><i class="fas fa-fw fa-calendar-alt" aria-hidden="true"></i> Updated:</strong> <time class="dt-published" datetime="2024-05-01T00:00:00+00:00">May 1, 2024</time></p>

      </footer>

      <section class="page__share">
  
    <h4 class="page__share-title">Share on</h4>
  

  <a href="https://twitter.com/intent/tweet?text=Why+Hibernate+Still+Logs+SQL+Even+When+Disabled+in+application.yaml%20http%3A%2F%2Ftodzhang.com%2Fblogs%2Ftech%2Fen%2FWhy_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml" class="btn btn--twitter" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on Twitter"><i class="fab fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span></a>

  <a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Ftodzhang.com%2Fblogs%2Ftech%2Fen%2FWhy_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml" class="btn btn--facebook" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on Facebook"><i class="fab fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span></a>

  <a href="https://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2Ftodzhang.com%2Fblogs%2Ftech%2Fen%2FWhy_Hibernate_Still_Logs_SQL_Even_When_Disabled_in_application.yaml" class="btn btn--linkedin" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="Share on LinkedIn"><i class="fab fa-fw fa-linkedin" aria-hidden="true"></i><span> LinkedIn</span></a>
</section>


      
  <nav class="pagination">
    
      <a href="/blogs/tech/en/The_Curious_Case_of_Azure_Key_Vault_Defender_Alerts_When_Security_Settings_Play_Hide_and_Seek" class="pagination--pager" title="The Curious Case of Azure Key Vault Defender Alerts - When Security Settings Play Hide and Seek
">Previous</a>
    
    
      <a href="/blogs/tech/en/unlocking_sql_superpowers_how_ctes_will_transform_your_database_queries" class="pagination--pager" title="Unlocking SQL Superpowers-&gt; How CTEs Will Transform Your Database Queries
">Next</a>
    
  </nav>

    </div>

    
  </article>

  
  
    <div class="page__related">
      <h2 class="page__related-title">You may also enjoy</h2>
      <div class="grid__wrapper">
        
          



<div class="grid__item">
  <article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
    
      <div class="archive__item-teaser">
        <img src="/assets/images/Todd_Stamp_Logo.png" alt="">
      </div>
    
    <h2 class="archive__item-title no_toc" itemprop="headline">
      
        <a href="/2026-04-14-why-your-url-shortener-is-a-ticking-time-bomb/" rel="permalink">
</a>
      
    </h2>
    

  <p class="page__meta">
    

    

    
      
      

      <span class="page__meta-readtime">
        <i class="far fa-clock" aria-hidden="true"></i>
        
          5 minute read
        
      </span>
    
  </p>


    <p class="archive__item-excerpt" itemprop="description">
</p>
  </article>
</div>

        
          



<div class="grid__item">
  <article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
    
      <div class="archive__item-teaser">
        <img src="/assets/images/Todd_Stamp_Logo.png" alt="">
      </div>
    
    <h2 class="archive__item-title no_toc" itemprop="headline">
      
        <a href="/2025-09-09-cn-nat-setup-issue-wireguard-technology-networking-security-vpn-firewall-configuration-issues/" rel="permalink">
</a>
      
    </h2>
    

  <p class="page__meta">
    

    

    
      
      

      <span class="page__meta-readtime">
        <i class="far fa-clock" aria-hidden="true"></i>
        
          3 minute read
        
      </span>
    
  </p>


    <p class="archive__item-excerpt" itemprop="description">
</p>
  </article>
</div>

        
          



<div class="grid__item">
  <article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
    
      <div class="archive__item-teaser">
        <img src="/assets/images/Todd_Stamp_Logo.png" alt="">
      </div>
    
    <h2 class="archive__item-title no_toc" itemprop="headline">
      
        <a href="/blogs/tech/en/minikube-windows-path-pitfall" rel="permalink">Git Bash on Windows: The MSYS Path Conversion Pitfall
</a>
      
    </h2>
    

  <p class="page__meta">
    

    

    
      
      

      <span class="page__meta-readtime">
        <i class="far fa-clock" aria-hidden="true"></i>
        
          11 minute read
        
      </span>
    
  </p>


    <p class="archive__item-excerpt" itemprop="description">
  “Know your enemy and know yourself.” — Sun Tzu, The Art of War


</p>
  </article>
</div>

        
          



<div class="grid__item">
  <article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
    
      <div class="archive__item-teaser">
        <img src="/assets/images/Todd_Stamp_Logo.png" alt="">
      </div>
    
    <h2 class="archive__item-title no_toc" itemprop="headline">
      
        <a href="/blogs/tech/zh/every-sleep-is-a-lie" rel="permalink">你脚本里的每一个 sleep 都在说谎
</a>
      
    </h2>
    

  <p class="page__meta">
    

    

    
      
      

      <span class="page__meta-readtime">
        <i class="far fa-clock" aria-hidden="true"></i>
        
          8 minute read
        
      </span>
    
  </p>


    <p class="archive__item-excerpt" itemprop="description">
  “知而不行，只是未知。” —— 王阳明


</p>
  </article>
</div>

        
      </div>
    </div>
  
  
</div>
    </div>

    
      <div class="search-content">
        <div class="search-content__inner-wrap"><form class="search-content__form" onkeydown="return event.key != 'Enter';" role="search">
    <label class="sr-only" for="search">
      Enter your search term...
    </label>
    <input type="search" id="search" class="search-input" tabindex="-1" placeholder="Enter your search term..." />
  </form>
  <div id="results" class="results"></div></div>

      </div>
    

    <div id="footer" class="page__footer">
      <footer>
        <!-- start custom footer snippets -->

<!-- 现代化交互元素 -->
<div class="scroll-indicator"></div>
<button class="theme-toggle" id="themeToggle" aria-label="切换主题">
  <span id="themeIcon">🌙</span>
</button>

<!-- 现代化JavaScript功能 -->
<script>
document.addEventListener('DOMContentLoaded', function() {
  // 主题切换功能
  const themeToggle = document.getElementById('themeToggle');
  const themeIcon = document.getElementById('themeIcon');
  const body = document.body;
  
  // 检查本地存储的主题设置
  const savedTheme = localStorage.getItem('theme') || 'light';
  body.setAttribute('data-theme', savedTheme);
  updateThemeIcon(savedTheme);
  
  themeToggle.addEventListener('click', function() {
    const currentTheme = body.getAttribute('data-theme');
    const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
    
    body.setAttribute('data-theme', newTheme);
    localStorage.setItem('theme', newTheme);
    updateThemeIcon(newTheme);
  });
  
  function updateThemeIcon(theme) {
    themeIcon.textContent = theme === 'dark' ? '☀️' : '🌙';
  }
  
  // 滚动指示器
  const scrollIndicator = document.querySelector('.scroll-indicator');
  
  window.addEventListener('scroll', function() {
    const scrollTop = window.pageYOffset;
    const docHeight = document.body.scrollHeight - window.innerHeight;
    const scrollPercent = (scrollTop / docHeight) * 100;
    
    scrollIndicator.style.width = scrollPercent + '%';
  });
  
  // 平滑滚动到顶部按钮
  const scrollToTopBtn = document.createElement('button');
  scrollToTopBtn.innerHTML = '↑';
  scrollToTopBtn.className = 'scroll-to-top';
  scrollToTopBtn.style.cssText = `
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  `;
  
  document.body.appendChild(scrollToTopBtn);
  
  window.addEventListener('scroll', function() {
    if (window.pageYOffset > 300) {
      scrollToTopBtn.style.opacity = '1';
      scrollToTopBtn.style.visibility = 'visible';
    } else {
      scrollToTopBtn.style.opacity = '0';
      scrollToTopBtn.style.visibility = 'hidden';
    }
  });
  
  scrollToTopBtn.addEventListener('click', function() {
    window.scrollTo({
      top: 0,
      behavior: 'smooth'
    });
  });
  
  scrollToTopBtn.addEventListener('mouseenter', function() {
    this.style.transform = 'scale(1.1)';
    this.style.boxShadow = '0 10px 15px -3px rgba(0, 0, 0, 0.2)';
  });
  
  scrollToTopBtn.addEventListener('mouseleave', function() {
    this.style.transform = 'scale(1)';
    this.style.boxShadow = '0 4px 6px -1px rgba(0, 0, 0, 0.1)';
  });
  
  // 文章卡片悬停效果增强
  const archiveItems = document.querySelectorAll('.archive__item');
  archiveItems.forEach(item => {
    item.addEventListener('mouseenter', function() {
      this.style.transform = 'translateY(-8px) scale(1.02)';
    });
    
    item.addEventListener('mouseleave', function() {
      this.style.transform = 'translateY(0) scale(1)';
    });
  });
  
  // 懒加载图片
  const images = document.querySelectorAll('img[data-src]');
  const imageObserver = new IntersectionObserver((entries, observer) => {
    entries.forEach(entry => {
      if (entry.isIntersecting) {
        const img = entry.target;
        img.src = img.dataset.src;
        img.classList.remove('lazy');
        imageObserver.unobserve(img);
      }
    });
  });
  
  images.forEach(img => imageObserver.observe(img));
  
  // 添加页面加载动画
  const loadingSpinner = document.createElement('div');
  loadingSpinner.className = 'loading-spinner';
  document.body.appendChild(loadingSpinner);
  
  window.addEventListener('load', function() {
    setTimeout(() => {
      loadingSpinner.style.opacity = '0';
      setTimeout(() => {
        loadingSpinner.remove();
      }, 300);
    }, 500);
  });
  
  // 代码块复制功能
  const codeBlocks = document.querySelectorAll('pre code');
  codeBlocks.forEach(block => {
    const button = document.createElement('button');
    button.textContent = '复制';
    button.style.cssText = `
      position: absolute;
      top: 10px;
      right: 10px;
      background: rgba(255, 255, 255, 0.1);
      color: white;
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 4px;
      padding: 4px 8px;
      font-size: 12px;
      cursor: pointer;
      transition: all 0.3s ease;
    `;
    
    const pre = block.parentElement;
    pre.style.position = 'relative';
    pre.appendChild(button);
    
    button.addEventListener('click', function() {
      navigator.clipboard.writeText(block.textContent).then(() => {
        button.textContent = '已复制!';
        setTimeout(() => {
          button.textContent = '复制';
        }, 2000);
      });
    });
  });
});
</script>

<!-- end custom footer snippets -->
        <div class="page__footer-follow">
  <ul class="social-icons">
    
      <li><strong>Follow:</strong></li>
    

    

    
      <li><a href="/feed.xml"><i class="fas fa-fw fa-rss-square" aria-hidden="true"></i> Feed</a></li>
    
  </ul>
</div>

<div class="page__footer-copyright">&copy; 2026 Highly Distinguish. Powered by <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> &amp; <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>

      </footer>
    </div>

    
  <script src="/assets/js/main.min.js"></script>




<script src="/assets/js/lunr/lunr.min.js"></script>
<script src="/assets/js/lunr/lunr-store.js"></script>
<script src="/assets/js/lunr/lunr-en.js"></script>




  <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-96218029-2"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-96218029-2', { 'anonymize_ip': false});
</script>









  </body>
</html>
